本文介紹了為什么 messageReactionAdd 什么都不做 discord.js的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我正在嘗試使用 node.js 編寫一個不和諧的機器人,但我遇到了 messageReactionAdd 的問題我現在不明白為什么當我對表情符號做出反應時機器人什么都不做.
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
僅適用于緩存消息.您需要在代碼中添加原始事件以觸發任何消息.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
這篇關于為什么 messageReactionAdd 什么都不做 discord.js的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!