fix up dm channel hack, supress if we still have no channel

This commit is contained in:
Cynthia Foxwell 2021-07-26 12:26:57 -06:00
parent 141aea9a50
commit 1b03d4093a

View file

@ -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) => {