module.exports={data:newSlashCommandBuilder().setName('ping4').setDescription('Replies with Pong, but deferred!'),asyncexecute(interaction){// 延迟回复,此时会有个初始回复“应用程序正在响应”awaitinteraction.deferReply();// 利用导入的 wait,故意等待 4000 毫秒awaitwait(4000);// 进行真正的回复awai...
Chapter 8 - 斜杠命令的多重命令名 比如代码commands/utils/sameCmd.js,改造自commands/subCmd.js: const{SlashCommandBuilder}=require('discord.js');module.exports={data:newSlashCommandBuilder().setName('samecmd').setDescription('Subcommand! Reply with user\'s or server \'s info.').addSubcommand(...
动态购物命令是基于Discord.js库开发的,它利用了Discord的交互式命令功能。这些命令可以通过Discord的slash commands或者message commands来实现,用户可以通过点击按钮或者输入特定的命令来触发相应的操作。 优势 用户体验:交互式的命令提供了更好的用户体验,用户无需记住复杂的命令格式。
我也认为@user16 16…方法更简单,但是当您使用SlashCommandBuilder时,您不需要在定义时使用builders子...
const{SlashCommandBuilder}=require('discord.js');module.exports={data:newSlashCommandBuilder().setName('quote').setDescription('获取今天的励志名言'),asyncexecute(interaction){constquotes=["千里之行,始于足下。","机会总是垂青于那些有准备的人。","成功并非终点,勇气才是继续前行的力量。",];constra...
export const data = new SlashCommandBuilder() .setName("reload") .setDescription("Reload the command handler") export async function run({ interaction, client, handler }: SlashCommandProps) { interaction.deferReply({ ephemeral: true }); await handler.reloadCommands(); client.debug('Reloaded c...
commands/modals/modal.js const { ActionRowBuilder, ModalBuilder, SlashCommandBuilder, TextInputBuilder, TextInputStyle } = require('discord.js'); module.exports = { data: new SlashCommandBuilder() .setName('modal') .setDescription('Replies with a pop-up form!'), ...
Slash Command: import{Command,Client,InteractionCommand}from"discord.js-ext-command";import{CommandInteraction,GatewayIntentBits,SlashCommandBuilder}from"discord.js";constclient=newDiscordCommands({prefix:"!"},{intents:[GatewayIntentBits.Guilds]});client.login("token");@CommandclassHelloWorldCommandimpleme...
commands/embeds/embedWithAttachment.js: const { AttachmentBuilder, EmbedBuilder, SlashCommandBuilder } = require('discord.js'); module.exports = { data: new SlashCommandBuilder() .setName('embedattachment') .setDescription('Replies with embed!'), ...
slashCommands) console.log(client.messageCommand) resgisterGuildCommand({ clientId: 'client id goes here', guilldId: 'guilid id goes here', token: "token goes here", commands: JsonData, // the slash command loader already returns the collection and the jsonData }) client.login("token ...