我想从交互消息中获取消息 ID,但我无法获取它:|
discord.js 版本:^13.1.0
client.on('interactionCreate',async interaction => {
if(interaction.commandName==='test') {
let message = await interaction.reply({content:'testing...',ephemeral:true});
console.log(message); //undefined
}
});
您可以使用CommandInteraction#fetchReply()方法来获取初始响应的 Message 实例。
例子:
client.on('interactionCreate', async (interaction) => {
if (interaction.commandName === 'test') {
interaction.reply({
content: 'testing...',
ephemeral: true,
})
const message = await interaction.fetchReply()
console.log(message)
}
})
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句