From 58e5d19cf6165df615f8e89c771d4b0b3cfff6f4 Mon Sep 17 00:00:00 2001 From: Josee9988 Date: Sat, 26 Jun 2021 15:40:12 +0200 Subject: [PATCH] "added extra checks for the send method" --- src/commands/commands-controller.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/commands/commands-controller.ts b/src/commands/commands-controller.ts index d30bb7c..5656fab 100644 --- a/src/commands/commands-controller.ts +++ b/src/commands/commands-controller.ts @@ -134,13 +134,13 @@ export default class CommandsController { if (forceChannelToBeTheSame) { // if we want the channel of the caller to be the same as the DB. (!dimg now) if (!checkIfUserIsAdmin(message)) return; if (server.channelId == message.channel.id) { - await this.fetchAndSendPhoto(server); + await this.fetchAndSendPhoto(server).catch(() => console.error(`fetchAndSendPhoto failed for server ${server}`)); } else { // if the caller channel isn't the same show error await message.channel.send( ":interrobang:To use this command, talk in the previously selected channel"); } } else { // if it is called from setAlbumLink to display the 1st photo, after the !dimg albumlink - await this.fetchAndSendPhoto(server); + await this.fetchAndSendPhoto(server).catch(() => console.error(`fetchAndSendPhoto failed for server ${server}`)); } } else { // albumlink or channel id aren't set await message.channel.send( @@ -152,7 +152,7 @@ export default class CommandsController { // iterate over every document and send the photos to every respective server for (const dimg of dimgs) { if (dimg.albumLink != null || dimg.channelId != null) - await this.fetchAndSendPhoto(dimg); + await this.fetchAndSendPhoto(dimg).catch(() => console.error(`fetchAndSendPhoto failed for server ${dimg.serverId}`)); } } }