From fd247008b4b22ae82ac8fbe84bf186e452b75cb5 Mon Sep 17 00:00:00 2001 From: Nico105 <63612668+Nico105@users.noreply.github.com> Date: Tue, 21 Dec 2021 18:28:54 +0100 Subject: [PATCH] hard check for deleted msg this maybe reduces the occurrences of stuck/not ending gaws because of rare errors that we didnt put an exeption for in the if statement. I guess we have to see. Lmk if there are any better ideas. --- src/Giveaway.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/Giveaway.js b/src/Giveaway.js index dbb990db..c146e659 100644 --- a/src/Giveaway.js +++ b/src/Giveaway.js @@ -375,21 +375,12 @@ class Giveaway extends EventEmitter { */ async fetchMessage() { return new Promise(async (resolve, reject) => { - if (!this.messageId) return; - let tryLater = false; + let tryLater = true; const channel = await this.client.channels.fetch(this.channelId).catch((err) => { - // prettier-ignore - if ((err.httpStatus).toString().startsWith('5') || err.httpStatus === 429 || err.code === 130000) { - tryLater = true; - } + if (err.code === 10003) tryLater = false; }); const message = await channel?.messages.fetch(this.messageId).catch((err) => { - // prettier-ignore - { - if ((err.httpStatus).toString().startsWith('5') || err.httpStatus === 429 || err.code === 130000) { - tryLater = true; - } - } + if (err.code === 10008) tryLater = false; }); if (!message) { if (!tryLater) {