You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The exports.trash function reacts to most bot messages with a trash emote. When the user clicks on the trash emote, the bot the message sent will be removed along with the reactions. If the user does not click on the trash emote, the collector will eventually end and the collector end event will be fired removing the trash emote reaction from the message and the message will not be deleted.
Issue
The issue happens when the user clicks on the trash emote, the message gets deleted but the console logs a Discord API Error: Unknown Message with a path indicating that the code is trying to remove reactions from a non-existent message. The issue is msg.deleted is returning false when it should be returning true, thus causing the code to remove reactions from a non-existent message.
Hypothesis
My guess is the collector is ending too fast for the Discord API to catch up and return the correct value onto msg.deleted. I thought of passing in a boolean when collector.stop() is called to stop the code in collector.on('end', => {...} from firing but it seems like a hassle to do all that. There has to be a easier way I'm not seeing.
Context
The
exports.trash
function reacts to most bot messages with a trash emote. When the user clicks on the trash emote, the bot the message sent will be removed along with the reactions. If the user does not click on the trash emote, the collector will eventually end and the collector end event will be fired removing the trash emote reaction from the message and the message will not be deleted.Issue
The issue happens when the user clicks on the trash emote, the message gets deleted but the console logs a
Discord API Error: Unknown Message
with a path indicating that the code is trying to remove reactions from a non-existent message. The issue ismsg.deleted
is returningfalse
when it should be returningtrue
, thus causing the code to remove reactions from a non-existent message.Hypothesis
My guess is the collector is ending too fast for the Discord API to catch up and return the correct value onto
msg.deleted
. I thought of passing in a boolean whencollector.stop()
is called to stop the code incollector.on('end', => {...}
from firing but it seems like a hassle to do all that. There has to be a easier way I'm not seeing.https://github.com/valkyrienyanko/ValksBot/blob/2862a784b99515edc1dce84af9d0168149aed9cb/modules/React.js#L13-L38
Line 35 is where the code removes the trash emote.
The text was updated successfully, but these errors were encountered: