• If you need help or want to discuss things, you now can also join us on our Discord Server!

EN Error in my script

Hello, I recently developed a script to detect when a user will react to a message, and then know if the channel id matches a certain id.

Here is my code:
/** @property {DiscordMessage} [message] */

event.on('discord:MESSAGE_REACTION_ADD', function (ev, client) {
if (ev.message.channelID() == "895489651559792691") {
engine.log("Channel ID:" + ev.message.channelID())
}
});

But I encounter an error that I can't solve, it's how to get the id of the channel where the reaction was put:

2021-10-13T21:41:33+02:00 error on callback func: Uncaught exception: TypeError: Cannot read property 'channelID' of undefined at reaction_rules:23:23 if (ev.message.channelID() == "895489651559792691") { ^ Stack trace: TypeError: Cannot read property 'channelID' of undefined at reaction_rules:23:24

Thank you in advance for your help!
 
Top