[英]Discord.js V13: How to edit Message Object of Interaction?
I am trying to update my discord bot to the new version of discord.js (v13).我正在尝试将我的 discord 机器人更新到新版本的 discord.js (v13)。 I have a message with an embed and two buttons, one for previous Page and one for next page.
我有一条带有嵌入和两个按钮的消息,一个用于上一页,一个用于下一页。 When a user clicks a button, I am trying to edit the embed to show something else.
当用户单击一个按钮时,我正在尝试编辑嵌入以显示其他内容。 But then I get a
但后来我得到一个
TypeError: interaction.message.edit() is not a function.
类型错误:interaction.message.edit() 不是 function。
I can print out the interaction.message
and it shows the message Object, but the function can not be called.我可以打印出
interaction.message
并显示消息 Object,但无法调用 function。 I am using the interactionCreate
event.我正在使用
interactionCreate
事件。
Thanks in advance!提前致谢!
You can use the interaction.update()
method:您可以使用
interaction.update()
方法:
// send a message
message.channel.send({ embeds: [embed], components: [buttons] })
/*
listen for the "interactionCreate" event or use any other method
of detecting an interaction like interaction collectors or awaitMessageComponent
*/
client.on("interactionCreate", (interaction) => {
interaction.update({ embeds: [aDifferentEmbed] })
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.