【发布时间】:2022-07-17 20:17:00
【问题描述】:
我有这个非常简单的命令:
let row = new Discord.MessageActionRow().addComponents(...) // The .. is too long so i'll just remove it for this question
int.reply({ content : 'pong', components : [row]})
完美运行。它使用组件发送消息并且工作得很好。 问题是现在我想听按钮。 在消息上,我可以做
message.reply({ content : 'ok', components : [row]})
.then(msg =>{
let collector = msg.createMessageComponentCollector({ componentType : 'BUTTON', time : 10e5 })
// Collector thingys
})
.catch(console.error)
这也很完美,我可以听消息并做点什么:D 现在的问题是,在回复消息时,promise 会返回 undefined
int.reply('Replied to your message')
如何获得回复并能够听到它的按钮? :/
编辑: 我真的找到了。 我只需要在发送交互响应时添加 { fetchReply : true } 例如:
const reply = await interaction.reply({ content : 'Test !', components : [row], fetchReply : true})
// Do something with "reply"..
【问题讨论】:
标签: javascript node.js async-await discord discord.js