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

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;
}
}
}