From 7646b3fc35e6f3d247db692e825f6b5fb6835086 Mon Sep 17 00:00:00 2001 From: DJj123dj <80536295+DJj123dj@users.noreply.github.com> Date: Sun, 15 Dec 2024 20:11:39 +0100 Subject: [PATCH] Increased HTML Transcript log level --- src/core/api/openticket/transcript.ts | 2 ++ src/data/openticket/transcriptLoader.ts | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/core/api/openticket/transcript.ts b/src/core/api/openticket/transcript.ts index 5e89525..6be48ff 100644 --- a/src/core/api/openticket/transcript.ts +++ b/src/core/api/openticket/transcript.ts @@ -246,6 +246,8 @@ export class ODTranscriptCollector { } } }catch{} + + //DEPRECATED WARNING!!! => msg.interaction might break in a future version of discord.js => required for slash command name }else if (msg.interaction && msg.interaction.type == discord.InteractionType.ApplicationCommand){ //slash command reply const member = await msg.guild.members.fetch(msg.interaction.user.id) diff --git a/src/data/openticket/transcriptLoader.ts b/src/data/openticket/transcriptLoader.ts index 3f46803..b0ec97e 100644 --- a/src/data/openticket/transcriptLoader.ts +++ b/src/data/openticket/transcriptLoader.ts @@ -448,15 +448,24 @@ export const loadAllTranscriptCompilers = async () => { const req = new ODHTTPHtmlPostRequest("apis.dj-dj.be",htmlFinal) const res = await req.run() + //check status if (!res || res.status != 200 || !res.body){ - if (res.status == 429) return {ticket,channel,user,success:false,errorReason:"Failed to upload HTML Transcripts due to Ratelimt! Try again in a few minutes!",messages,data:null} - else return {ticket,channel,user,success:false,errorReason:"Failed to upload HTML Transcripts!",messages,data:null} + //ratelimit error + if (res.status == 429) return {ticket,channel,user,success:false,errorReason:"Failed to upload HTML Transcripts! (Ratelimit)\nTry again in a few minutes!",messages,data:null} + + //unknown status error + openticket.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body) + return {ticket,channel,user,success:false,errorReason:"Failed to upload HTML Transcripts! (Unknown Error)",messages,data:null} } + //check body try{ var data: api.ODTranscriptHtmlV2Response = JSON.parse(res.body) - if (!data || data["status"] != "success") return {ticket,channel,user,success:false,errorReason:"Failed to upload HTML Transcripts! (Status: Error)",messages,data:null} + if (!data || data["status"] != "success"){ + openticket.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body) + return {ticket,channel,user,success:false,errorReason:"Failed to upload HTML Transcripts! (Server 500 Error)",messages,data:null}} }catch{ - return {ticket,channel,user,success:false,errorReason:"Failed to upload HTML Transcripts due to JSON parse error!",messages,data:null} + openticket.debugfile.writeNote("HTML Transcripts Error => status: "+res.status+", body:\n"+res.body) + return {ticket,channel,user,success:false,errorReason:"Failed to upload HTML Transcripts! (JSON parse error)",messages,data:null} } const url = "https://transcripts.dj-dj.be/v2/"+data.time+"_"+data.id+".html"