我正在创建一个投票命令,我正在尝试获取单个表情符号的反应计数。当我今天早些时候查找消息时,它返回了消息数据,并显示了 reactions
集合。但是,当我查找反应集合时,它返回了 undefined
。经过多次调试和尝试,它只返回通道中所有消息的列表。
const embedMessage = await channel.messages.fetch(row.get('messageID')); //row.get(messageID) is just looking at a database for the stored messageID, I checked and the database is storing that correctly.
const embedMessageReacts = embedMessage.reactions; //This returns 'undefined'
//I also have the original 'embed' constant cached from the original embed message sending higher in the code but it no longer shows up as anything.
//The 'channel' constant works as normal.
//Also, the collection cannot be empty as the bot itself reacts to the message I am getting. Meaning, the message already has at least 2 reactions on it (the minimum for the command to work causes there to be at least 2 reactions)
//Lastly, it is not listening for reactions (although there is a listener for when the message containing these reactions is sent), so I have to look it up manually.
//Instead, these run when a certain time has elapsed.
//Hopefully there is a solution because this issue has taken up 2 days of time.
答案 0 :(得分:0)
不再捕捉反应。
你必须在使用前抓住它们。
像这样:
if(!embedMessage){ return(false); }
const embedMessageReacts = embedMessage.reactions.cache;
您可以轻松数出表情符号
let Heart = embedMessage.reactions.cache.get('♥️').count;