標題可能有點令人困惑,所以這是我鍵入命令時發生的情況的螢屏截圖:

它有效,但同時也失敗了。我沒有從這次互動中得到任何錯誤。這是我的代碼:
const { SlashCommandBuilder } = require("@discordjs/builders");
const { MessageEmbed } = require("discord.js");
module.exports = {
data: new SlashCommandBuilder()
.setName("suggest")
.setDescription("Send your suggestion to the specified channel")
.addStringOption((option) =>
option
.setName("suggestion")
.setDescription("Your suggestion")
.setRequired(true)
),
async execute(interaction) {
let suggestion = interaction.options.getString("suggestion");
const embed = new MessageEmbed()
.setColor("#0099ff")
.setTitle(`New suggestion by ${interaction.member.displayName}`)
.setDescription(`${suggestion}`);
await interaction.channel
.send({
embeds: [embed],
})
.then(function (interaction) {
interaction.react(`??`).then(interaction.react(`??`));
});
},
};
uj5u.com熱心網友回復:
嘗試推遲回復。關于它的更多資訊在這里
例如,
const wait = require('util').promisify(setTimeout);
client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
if (interaction.commandName === 'ping') {
await interaction.deferReply();
await wait(4000);
await interaction.editReply('Pong!');
}
});
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/353713.html
標籤:javascript 不和谐.js
