Upgrade discord.js from v13 to v14
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
const { SlashCommandBuilder } = require("@discordjs/builders");
|
const { SlashCommandBuilder } = require("discord.js");
|
||||||
const { Card, User, Character } = require("../models");
|
const { Card, User, Character } = require("../models");
|
||||||
|
|
||||||
//fetch all cards owned by the user and list them
|
//fetch all cards owned by the user and list them
|
||||||
|
|||||||
47
commands/debug.js
Normal file
47
commands/debug.js
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
const { SlashCommandBuilder } = require("@discordjs/builders");
|
const { SlashCommandBuilder } = require("discord.js");
|
||||||
const { Card, User } = require("../models");
|
const { Card, User } = require("../models");
|
||||||
const { customAlphabet } = require("nanoid");
|
const { customAlphabet } = require("nanoid");
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const { SlashCommandBuilder } = require("@discordjs/builders");
|
const { SlashCommandBuilder } = require("discord.js");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//User registration
|
//User registration
|
||||||
const { SlashCommandBuilder } = require("@discordjs/builders");
|
const { SlashCommandBuilder } = require("discord.js");
|
||||||
const { User } = require("../models");
|
const { User } = require("../models");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const { SlashCommandBuilder } = require("@discordjs/builders");
|
const { SlashCommandBuilder } = require("discord.js");
|
||||||
const { User } = require("../models");
|
const { User } = require("../models");
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
require("dotenv").config();
|
require("dotenv").config();
|
||||||
const { REST } = require("@discordjs/rest");
|
const { REST } = require("@discordjs/rest");
|
||||||
const { Routes } = require("discord-api-types/v9")
|
const { Routes } = require("discord-api-types/v10")
|
||||||
const { Guild, User } = require("../models");
|
const { Guild, User } = require("../models");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
10
index.js
10
index.js
@@ -1,7 +1,7 @@
|
|||||||
require("dotenv").config();
|
require("dotenv").config();
|
||||||
const { Console } = require("console");
|
const { Console } = require("console");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const {Client, Intents, Collection} = require("discord.js");
|
const {Client, GatewayIntentBits, Collection} = require("discord.js");
|
||||||
const dbUtil = require("./util/db")
|
const dbUtil = require("./util/db")
|
||||||
|
|
||||||
const logger = new Console({
|
const logger = new Console({
|
||||||
@@ -9,10 +9,10 @@ const logger = new Console({
|
|||||||
stderr: process.stderr
|
stderr: process.stderr
|
||||||
});
|
});
|
||||||
const client = new Client({intents: [
|
const client = new Client({intents: [
|
||||||
Intents.FLAGS.GUILDS,
|
GatewayIntentBits.Guilds,
|
||||||
Intents.FLAGS.GUILD_MESSAGES,
|
GatewayIntentBits.GuildMessages,
|
||||||
Intents.FLAGS.GUILD_MEMBERS,
|
GatewayIntentBits.GuildPresences,
|
||||||
Intents.FLAGS.GUILD_PRESENCES
|
GatewayIntentBits.GuildMembers
|
||||||
]});
|
]});
|
||||||
|
|
||||||
const commandFiles = fs.readdirSync("./commands").filter(file => file.endsWith(".js"));
|
const commandFiles = fs.readdirSync("./commands").filter(file => file.endsWith(".js"));
|
||||||
|
|||||||
1021
package-lock.json
generated
1021
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -10,9 +10,9 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/builders": "^0.12.0",
|
|
||||||
"@discordjs/rest": "^0.3.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",
|
"dotenv": "^16.0.0",
|
||||||
"mysql2": "^2.3.3",
|
"mysql2": "^2.3.3",
|
||||||
"nanoid": "^3.0.0",
|
"nanoid": "^3.0.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user