Discord按钮交互失败,但机器人响应正常,有什么办法可以去掉按钮下交互失败的文字吗?
Discord Buttons Interaction Failed, But The Bot Responded Normally, Any Way To Remove The Interaction Failed Text under the button?
所以我尝试制作一个发送嵌入和按钮的不和谐机器人,当我使用按钮时,机器人正常响应它,但在按钮下方,有一个文本说“交互失败”,这里是代码
const akiLangEmbed = new MessageEmbed()
.setTitle(`${message.author.tag}`)
.setDescription(`Please Select Your Language`)
.setColor(client.config.embedcolor)
.setTimestamp()
const lang1 = new MessageActionRow().addComponents(
new MessageButton()
.setStyle("SUCCESS")
.setLabel("English")
.setCustomId("en"),
new MessageButton()
.setStyle("SUCCESS")
.setLabel("Indonesia")
.setCustomId("id"),
new MessageButton()
.setStyle("SUCCESS")
.setLabel("Japan")
.setCustomId("ja")
)
const lang2 = new MessageActionRow().addComponents(
new MessageButton()
.setStyle("SUCCESS")
.setLabel("Germany")
.setCustomId("gr"),
new MessageButton()
.setStyle("SUCCESS")
.setLabel("France")
.setCustomId("fr"),
new MessageButton()
.setStyle("SUCCESS")
.setLabel("Chinese")
.setCustomId("zh")
)
const langPick = await message.channel.send({ embeds: [akiLangEmbed], components: [lang1, lang2]})
const filter = (interaction) => {
if (interaction.user.id === message.author.id) return true;
return interaction.reply({
content: `Only ${message.author.tag} can use this interaction!`,
ephemeral: true,
});
};
const collector = langPick.createMessageComponentCollector({
filter,
componentType: "BUTTON",
time: 60000 * 5
})
collector.on("collect", async (interaction) => {
if(interaction.customId === "en") {
await akinator(message, {
language: "en",
useButtons: true,
embedColor: client.config.embedcolor
})
}
if(interaction.customId === "id") {
await akinator(message, {
language: "id",
useButtons: true,
embedColor: client.config.embedcolor
})
}
if(interaction.customId === "ja") {
await akinator(message, {
language: "ja",
useButtons: true,
embedColor: client.config.embedcolor
})
}
})
是的,我已经使用 const 和 require 导入了代码顶部所需的 all 包,任何 帮忙?
您需要推迟互动。将此行粘贴到 collector.on 活动的第一行。
await interaction.deferUpdate();
所以我尝试制作一个发送嵌入和按钮的不和谐机器人,当我使用按钮时,机器人正常响应它,但在按钮下方,有一个文本说“交互失败”,这里是代码
const akiLangEmbed = new MessageEmbed()
.setTitle(`${message.author.tag}`)
.setDescription(`Please Select Your Language`)
.setColor(client.config.embedcolor)
.setTimestamp()
const lang1 = new MessageActionRow().addComponents(
new MessageButton()
.setStyle("SUCCESS")
.setLabel("English")
.setCustomId("en"),
new MessageButton()
.setStyle("SUCCESS")
.setLabel("Indonesia")
.setCustomId("id"),
new MessageButton()
.setStyle("SUCCESS")
.setLabel("Japan")
.setCustomId("ja")
)
const lang2 = new MessageActionRow().addComponents(
new MessageButton()
.setStyle("SUCCESS")
.setLabel("Germany")
.setCustomId("gr"),
new MessageButton()
.setStyle("SUCCESS")
.setLabel("France")
.setCustomId("fr"),
new MessageButton()
.setStyle("SUCCESS")
.setLabel("Chinese")
.setCustomId("zh")
)
const langPick = await message.channel.send({ embeds: [akiLangEmbed], components: [lang1, lang2]})
const filter = (interaction) => {
if (interaction.user.id === message.author.id) return true;
return interaction.reply({
content: `Only ${message.author.tag} can use this interaction!`,
ephemeral: true,
});
};
const collector = langPick.createMessageComponentCollector({
filter,
componentType: "BUTTON",
time: 60000 * 5
})
collector.on("collect", async (interaction) => {
if(interaction.customId === "en") {
await akinator(message, {
language: "en",
useButtons: true,
embedColor: client.config.embedcolor
})
}
if(interaction.customId === "id") {
await akinator(message, {
language: "id",
useButtons: true,
embedColor: client.config.embedcolor
})
}
if(interaction.customId === "ja") {
await akinator(message, {
language: "ja",
useButtons: true,
embedColor: client.config.embedcolor
})
}
})
是的,我已经使用 const 和 require 导入了代码顶部所需的 all 包,任何 帮忙?
您需要推迟互动。将此行粘贴到 collector.on 活动的第一行。
await interaction.deferUpdate();