【发布时间】:2022-12-10 22:30:31
【问题描述】:
我一直在研究 Discord 机器人并阅读文档。我对此很陌生,找不到关于该主题的任何 YT 教程,这是代码:
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('test')
.setDescription('Select a test to use.')
.addStringOption(option =>
option
.setName('type')
.setDescription('Type of test requested')),
async execute(interaction) {
const ptypes = interaction.options.getString('type') ?? 'No reason provided';
await interaction.reply(`You chose ${ptypes}`);
},
};
这是如何工作的:
/test > [click]test > [input]test
这是我希望它工作的方式:
/test > [input]test
【问题讨论】:
标签: javascript node.js discord.js