Upgrade discord.js from v13 to v14

This commit is contained in:
2022-08-18 11:26:51 +02:00
parent f93176a709
commit 317230c9c3
10 changed files with 710 additions and 384 deletions

View File

@@ -1,4 +1,4 @@
const { SlashCommandBuilder } = require("@discordjs/builders");
const { SlashCommandBuilder } = require("discord.js");
const { Card, User, Character } = require("../models");
//fetch all cards owned by the user and list them

47
commands/debug.js Normal file
View File

@@ -0,0 +1,47 @@
const { SlashCommandBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js");
const { customAlphabet } = require("nanoid");
module.exports = {
data: new SlashCommandBuilder()
.setName("debug")
.setDescription("debug feature")
.addStringOption((option) =>
option
.setName("feature")
.setDescription("The command to debug")
.setRequired(true)
),
async execute(interaction) {
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('primary')
.setLabel('Primary')
.setStyle(ButtonStyle.Primary),
);
await interaction.reply({ content: 'Pong!', components: [row] });
return;
switch (interaction.options.getString("feature")) {
case "ping":
interaction.reply({
content: "Pong!",
ephemeral: true
});
break;
case "ids":
const nanoid = customAlphabet('6789BCDFGHJKLMNPQRTW',6);
const ids = [];
for (let i = 0; i < 100; i++) {
console.log(nanoid());
ids.push(nanoid());
}
interaction.reply({
content: `${JSON.stringify(ids)}`,
ephemeral: false
});
break;
}
}
}

View File

@@ -1,4 +1,4 @@
const { SlashCommandBuilder } = require("@discordjs/builders");
const { SlashCommandBuilder } = require("discord.js");
const { Card, User } = require("../models");
const { customAlphabet } = require("nanoid");

View File

@@ -1,4 +1,4 @@
const { SlashCommandBuilder } = require("@discordjs/builders");
const { SlashCommandBuilder } = require("discord.js");
module.exports = {
data: new SlashCommandBuilder()

View File

@@ -1,5 +1,5 @@
//User registration
const { SlashCommandBuilder } = require("@discordjs/builders");
const { SlashCommandBuilder } = require("discord.js");
const { User } = require("../models");
module.exports = {

View File

@@ -1,4 +1,4 @@
const { SlashCommandBuilder } = require("@discordjs/builders");
const { SlashCommandBuilder } = require("discord.js");
const { User } = require("../models");

View File

@@ -1,6 +1,6 @@
require("dotenv").config();
const { REST } = require("@discordjs/rest");
const { Routes } = require("discord-api-types/v9")
const { Routes } = require("discord-api-types/v10")
const { Guild, User } = require("../models");
module.exports = {

View File

@@ -1,7 +1,7 @@
require("dotenv").config();
const { Console } = require("console");
const fs = require("fs");
const {Client, Intents, Collection} = require("discord.js");
const {Client, GatewayIntentBits, Collection} = require("discord.js");
const dbUtil = require("./util/db")
const logger = new Console({
@@ -9,10 +9,10 @@ const logger = new Console({
stderr: process.stderr
});
const client = new Client({intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MEMBERS,
Intents.FLAGS.GUILD_PRESENCES
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildMembers
]});
const commandFiles = fs.readdirSync("./commands").filter(file => file.endsWith(".js"));

1021
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -10,9 +10,9 @@
"author": "",
"license": "ISC",
"dependencies": {
"@discordjs/builders": "^0.12.0",
"@discordjs/rest": "^0.3.0",
"discord.js": "^13.6.0",
"discord-api-types": "^0.37.2",
"discord.js": "^14.0.0",
"dotenv": "^16.0.0",
"mysql2": "^2.3.3",
"nanoid": "^3.0.0",