Skip to content

Commit

Permalink
hard check for deleted msg
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Nico105 committed Dec 21, 2021
1 parent 6bbdfe4 commit fd24700
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/Giveaway.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit fd24700

Please sign in to comment.