問題描述
我正在嘗試使用 node.js 編寫一個不和諧的機器人,但我遇到了 messageReactionAdd 的問題我現(xiàn)在不明白為什么當我對表情符號做出反應(yīng)時機器人什么都不做.
I'am trying to code a discord bot with node.js, but i have a problem with messageReactionAdd I don't now why the bot does nothing when i react with an emoji.
我的代碼:
bot.on('messageReactionRemove', (reaction, user) => {
console.log("that work 1");
if(reaction.emoji.name === "white_check_mark") {
console.log("that work 2");
}})
推薦答案
事件 messageReactionAdd
和 messageReactionRemove
僅適用于緩存消息.您需要在代碼中添加原始事件以觸發(fā)任何消息.https://github.com/AnIdiotsGuide/discordjs-bot-guide/blob/master/coding-guides/raw-events.md
Events messageReactionAdd
and messageReactionRemove
working only for cached messages. You need add raw event to your code for trigger any message.
https://github.com/AnIdiotsGuide/discordjs-bot-guide/blob/master/coding-guides/raw-events.md
這篇關(guān)于為什么 messageReactionAdd 什么都不做 discord.js的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!