Event: MESSAGE_UPDATE causes crash when using checks
Closed this issue · 2 comments
Ryu945 commented
If you call if(!e.message.channel.is_private) {
on an edit while in guild chat as the first message, program crashes. If you call the identical code on message post for first messag, it doesn't crash. If you then edit that message and run the identical code again, it doesn't crash. The error is TypeError: Cannot read property 'channel' of null
. It seems the code bugs on older messages as well. You can say something else first but then scroll up and edit an older message and it bugs.
qeled commented
Message edits can have null message
.
/**
* Emitted when user updates their message.
* Contains null `message` if not cached.
* @event MESSAGE_UPDATE
* @property {GatewaySocket} socket
* @property {IMessage|null} message
* @property {Object} data - Raw message object received from server
*/
Ryu945 commented
What is the logic behind when it will have a null message verses not have a null message? If a message sometimes comes up null, how you can read the content of the newly edited message?