From 1b03d4093ac99efa80ebdc61cf3f4ac32007c3e5 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Mon, 26 Jul 2021 12:26:57 -0600 Subject: [PATCH] fix up dm channel hack, supress if we still have no channel --- src/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 4f87827..8b9fcbd 100644 --- a/src/index.js +++ b/src/index.js @@ -54,9 +54,15 @@ for (const file of fs.readdirSync(resolve(__dirname, "modules"))) { } bot.on("messageCreate", async (msg) => { + // fix DMs cause of gateway v8 changes if (!(msg.channel instanceof Eris.Channel) && msg.author.id != bot.user.id) { - msg.channel = await bot.getDMChannel(msg.author.id); + const newChannel = await bot.getDMChannel(msg.author.id); + if (msg.channel.id == newChannel.id) msg.channel = newChannel; } + + // if we still have no dm channel (threads cause this too) + if (!(msg.channel instanceof Eris.Channel)) return; + await CommandDispatcher(msg); }); bot.on("messageUpdate", (msg) => {