<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <style> body...
创建一个Discord客户端实例和一个SlashCommand实例: 定义一个斜杠命令处理函数,并使用@slash.slash装饰器将其注册为斜杠命令: 定义一个斜杠命令处理函数,并使用@slash.slash装饰器将其注册为斜杠命令: 在上面的代码中,command_name是斜杠命令的名称,description是斜杠命令的描述。command_function是处理斜杠命令的函数,ctx...
打开config.json配置文件并写入您的机器人令牌。 从项目文件夹中打开一个新的终端,然后运行app.js文件。 (示例运行命令: node app.js ) :red_question_mark: 斜杠命令选项的类型 NAME VALUE SUB_COMMAND 1 SUB_COMMAND_GROUP 2 STRING 所需:1积分电信网络下载...
const{SlashCommandBuilder}=require('discord.js');module.exports={data:newSlashCommandBuilder().setName('multireact').setDescription('Replies with reaction!'),asyncexecute(interaction){constmessage=awaitinteraction.reply({content:'You can react with Unicode emojis!',fetchReply:true});// "c u m"...
1.定义discord.Client和commands.Bot 你应该只使用一个,为了我下面的例子的目的,我将使用commands.bot...
我在常量值通道和原因中获得了选项,我正在尝试编辑通道权限以锁定通道。这是我当前的命令代码。 const { SlashCommandBuilder ...
For example, guild_id is optional because you would not receive one in a DM interaction. However, the behavior of slash commands within guilds today remains unchanged. We've also added a user object to the interaction payload. When a command is invoked from a DM, you will receive the ...
To add a slash command, you need to create a class with @Command decorator. The @Handler decorator will point to the command processing method. 💡 Example /* playlist.command.ts */ import { Command, Handler } from '@discord-nestjs/core'; import { CommandInteraction } from 'discord.js...
bot.remove_command('help') # slash = SlashCommand(bot, override_type = True, sync_on_cog_reload=True, sync_commands=True) ### Server-Join ### @bot.event async def on_guild_join(guild): with open("prefix.json", "r") as f: prefix = json.load(f) prefix[str(guild.id)] = "...
我想你可以按照教程:https://discordjs.guide/creating-your-bot/command-deployment.html#guild-commands...