Fix crash with message edits between bot restarts
parent
e0bd96e959
commit
0a9f26eaff
|
@ -76,11 +76,9 @@ bot.on('messageUpdate', async (msg, oldMessage) => {
|
||||||
if (msg.author.bot) return;
|
if (msg.author.bot) return;
|
||||||
if (await blocked.isBlocked(msg.author.id)) return;
|
if (await blocked.isBlocked(msg.author.id)) return;
|
||||||
|
|
||||||
let oldContent = oldMessage.content;
|
|
||||||
const newContent = msg.content;
|
|
||||||
|
|
||||||
// Old message content doesn't persist between bot restarts
|
// Old message content doesn't persist between bot restarts
|
||||||
if (oldContent == null) oldContent = '*Unavailable due to bot restart*';
|
const oldContent = oldMessage && oldMessage.content || '*Unavailable due to bot restart*';
|
||||||
|
const newContent = msg.content;
|
||||||
|
|
||||||
// Ignore bogus edit events with no changes
|
// Ignore bogus edit events with no changes
|
||||||
if (newContent.trim() === oldContent.trim()) return;
|
if (newContent.trim() === oldContent.trim()) return;
|
||||||
|
|
Loading…
Reference in New Issue