我试图让一个不和谐的机器人只是回复用户输入的确切消息。我有它的设置,所以命令看起来像“/tsay text:TextExample”是字符串选项,如果它工作,它会回复用户输入的“TextExample”。我试图得到文本,但我真的不知道怎么做。任何帮助都是感激的,因为我是JavaScript和discord.js的新手。以下是我目前拥有的
module.exports = {
data: new SlashCommandBuilder()
.setName('tsay')
.setDescription('Replies with the text that was entered (General)')
.addStringOption(option =>
option.setName('text')
.setDescription('Text to be copied')
.setRequired(true)),
async execute(interaction, client) {
const textOption = interaction.getOption('text');
const Text = textOption.content;
// Reply with the text
await interaction.editReply({
content: toString(Text)
});
}
}```
I tried searching up how to do it and look at different documentations but I couldn't find anything exactly that could help me solve my issue.
1条答案
按热度按时间8i9zcol21#
实际上我现在找到了一个修复方法。我不得不以不同的方式引用选项。下面是工作正常的更新代码