繁体   English   中英

Discord.JS 在消息中添加按钮

[英]Discord.JS Add a button to a message

我想将另一个按钮添加到我尝试过的现有消息(由机器人发送):

// const... log in... ....
let msg = await interaction.channel.fetchMessage(interaction.options.get('message-id'))
if(!msg || msg?.author?.id !== client.user.id) return interaction.reply({ content: "Error..." })

msg.edit({ embeds: ["a defined embed"], components: [row] })

当我编辑组件时,它会用新组件替换第一个组件。

如何在消息中添加新按钮?

不要编辑整个消息。 只需执行message.edit({components: [row]})

它应该只添加按钮而不编辑消息

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM