From a06221d27544e90134837427615ad36cfbab9186 Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Wed, 9 Aug 2023 09:20:36 +0200 Subject: [PATCH] Add error message if send command fails --- commands/admin/send.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/commands/admin/send.js b/commands/admin/send.js index 6152ab8..2aaf593 100644 --- a/commands/admin/send.js +++ b/commands/admin/send.js @@ -6,6 +6,11 @@ module.exports = { let channel = args[0]; let message = args.slice(1, args.length) message = message.join(" ") - client.channels.cache.get(channel).send(message) + try{ + client.channels.cache.get(channel).send(message) + }catch(err){ + console.error(`An error occurred while trying to send a message to ${channel}`,err); + message.channel.send("An error occurred while trying to send a message to that channel.\nCheck console for details."); + } } } \ No newline at end of file