From e209199134157fdfb7fb2b78ed1d2ec574faa601 Mon Sep 17 00:00:00 2001 From: TheEssem Date: Wed, 14 Apr 2021 19:57:35 -0500 Subject: [PATCH] Handle cases where error message can't be sent, added intents, disable private channels collection --- app.js | 10 +++++++++- events/messageCreate.js | 10 ++++++---- shard.js | 2 ++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app.js b/app.js index 51bb72e..04cbfa4 100644 --- a/app.js +++ b/app.js @@ -29,6 +29,14 @@ new Master(`Bot ${process.env.TOKEN}`, "/shard.js", { users: true, repliedUser: true }, - guildSubscriptions: false + guildSubscriptions: false, + intents: [ + "guilds", + "guildVoiceStates", + "guildMessages", + "guildMessageReactions", + "directMessages", + "directMessageReactions" + ] } }); \ No newline at end of file diff --git a/events/messageCreate.js b/events/messageCreate.js index 312b576..b0b2889 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -121,10 +121,12 @@ module.exports = async (client, message) => { await client.createMessage(message.channel.id, `${message.author.mention}, the request timed out before I could download that image. Try uploading your image somewhere else.`); } else { logger.error(error.toString()); - await client.createMessage(message.channel.id, "Uh oh! I ran into an error while running this command. Please report the content of the attached file here or on the esmBot Support server: ", [{ - file: Buffer.from(`Message: ${error}\n\nStack Trace: ${error.stack}`), - name: "error.txt" - }]); + try { + await client.createMessage(message.channel.id, "Uh oh! I ran into an error while running this command. Please report the content of the attached file here or on the esmBot Support server: ", [{ + file: Buffer.from(`Message: ${error}\n\nStack Trace: ${error.stack}`), + name: "error.txt" + }]); + } catch { /* silently ignore */ } } } }; diff --git a/shard.js b/shard.js index 2fd7c03..c68db99 100644 --- a/shard.js +++ b/shard.js @@ -111,6 +111,8 @@ class Shard extends Base { // connect to lavalink if (!sound.status && !sound.connected) await sound.connect(this.bot); + this.bot.privateChannels.limit = 0; + await database.setup(); // set activity (a.k.a. the gamer code)