diff --git a/src/main.js b/src/main.js index 6e348c2..7d1a9eb 100644 --- a/src/main.js +++ b/src/main.js @@ -91,15 +91,15 @@ function initBaseMessageHandlers() { */ bot.on("messageCreate", async msg => { if (! utils.messageIsOnInboxServer(msg)) return; - if (msg.author.bot) return; + if (msg.author.id === bot.user.id) return; const thread = await threads.findByChannelId(msg.channel.id); if (! thread) return; - if (msg.content.startsWith(config.prefix) || msg.content.startsWith(config.snippetPrefix)) { + if (! msg.author.bot && (msg.content.startsWith(config.prefix) || msg.content.startsWith(config.snippetPrefix))) { // Save commands as "command messages" thread.saveCommandMessageToLogs(msg); - } else if (config.alwaysReply) { + } else if (! msg.author.bot && config.alwaysReply) { // AUTO-REPLY: If config.alwaysReply is enabled, send all chat messages in thread channels as replies if (! utils.isStaff(msg.member)) return; // Only staff are allowed to reply @@ -150,7 +150,7 @@ function initBaseMessageHandlers() { */ bot.on("messageUpdate", async (msg, oldMessage) => { if (! msg || ! msg.author) return; - if (msg.author.bot) return; + if (msg.author.id === bot.user.id) return; if (await blocked.isBlocked(msg.author.id)) return; // Old message content doesn't persist between bot restarts @@ -161,7 +161,7 @@ function initBaseMessageHandlers() { if (newContent.trim() === oldContent.trim()) return; // 1) If this edit was in DMs - if (msg.channel instanceof Eris.PrivateChannel) { + if (! msg.author.bot && msg.channel instanceof Eris.PrivateChannel) { const thread = await threads.findOpenThreadByUserId(msg.author.id); if (! thread) return; @@ -170,7 +170,7 @@ function initBaseMessageHandlers() { } // 2) If this edit was a chat message in the thread - else if (utils.messageIsOnInboxServer(msg) && utils.isStaff(msg.member)) { + else if (utils.messageIsOnInboxServer(msg) && (msg.author.bot || utils.isStaff(msg.member))) { const thread = await threads.findOpenThreadByChannelId(msg.channel.id); if (! thread) return; @@ -183,9 +183,9 @@ function initBaseMessageHandlers() { */ bot.on("messageDelete", async msg => { if (! msg.author) return; - if (msg.author.bot) return; + if (msg.author.id === bot.user.id) return; if (! utils.messageIsOnInboxServer(msg)) return; - if (! utils.isStaff(msg.member)) return; + if (! msg.author.bot && ! utils.isStaff(msg.member)) return; const thread = await threads.findOpenThreadByChannelId(msg.channel.id); if (! thread) return;