Skip to content

Commit

Permalink
that didn't work either
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Oct 11, 2023
1 parent 07b0d49 commit c1c364e
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/client/automation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,15 @@ export class Automation {
if (!this.ticking) return;

// polls check:
this.client.polls.each(this.pollCheck.bind(null, this));
}, 1000); // each second
this.client.polls.each((p) => {
const poll = new Poll(p); // get methods back

if (poll.isTimeout()) {
poll.setStatus("ended");
poll.updateEmbed(this.client).then(() => this.client.polls.delete(poll.id));
}
});
}, 15000); // 15 seconds

// send to uptime kuma (only for production bot)
if (this.client.tokens.status) {
Expand All @@ -33,13 +40,4 @@ export class Automation {
); // 10 minutes
}
}

private pollCheck(p: Poll) {
const poll = new Poll(p); // get methods back

if (poll.isTimeout()) {
poll.setStatus("ended");
poll.updateEmbed(this.client).then(() => this.client.polls.delete(poll.id));
}
}
}

0 comments on commit c1c364e

Please sign in to comment.