From c03d329c3df096037ed0dca145af0dd93a24ad5c Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 24 Jul 2023 03:52:37 +0200 Subject: [PATCH 1/2] Fix unnecessary not, breaking entire bot --- src/execution.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/execution.ts b/src/execution.ts index 057d80e..f6ff0c1 100644 --- a/src/execution.ts +++ b/src/execution.ts @@ -121,7 +121,7 @@ function requestReply( * @returns if the request can be replied to */ function canReplyToRequest(request: apiRequest) { - return !(request.guild?.members.me?.permissionsIn(request.channel as GuildTextBasedChannel).has("SendMessages") ?? true); + return (request.guild?.members.me?.permissionsIn(request.channel as GuildTextBasedChannel).has("SendMessages") ?? true); } /** From f9097ae68dc14ccca7225499d7771231c8da4395 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 25 Jul 2023 04:16:59 +0200 Subject: [PATCH 2/2] Make error of the execution more verbose to the user --- src/execution.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/execution.ts b/src/execution.ts index f6ff0c1..038f32e 100644 --- a/src/execution.ts +++ b/src/execution.ts @@ -286,12 +286,19 @@ async function executeFromQueue(channel: string) { console.error(`Error ocurred while handling chat completion request (${(e as object).constructor.name}):`); console.error(e); + let errorText = "\n"; + + if (e instanceof Error) { + errorText += e.message; + } + else errorText = ""; + requestReply( message, { embeds: [{ color: 0xff0000, - description: "Something bad happened! :frowning:" + description: "Something bad happened! :frowning:" + errorText }], }, {allowedMentions: { repliedUser: false } },