Skip to content

Commit

Permalink
uptime kuma thingy
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Oct 8, 2023
1 parent 5957817 commit f59322b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/client/automation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Poll } from "@class/poll";
import { Client } from "@client";

/**
* Automate checking tasks, primarily used for polls
* Automate checking tasks with a given delay
* @author Juknum
*/
export class Automation {
Expand All @@ -22,8 +22,15 @@ export class Automation {
if (!this.ticking) return;

// polls check:
this.client.polls.each((p: Poll) => this.pollCheck(p));
this.client.polls.each(this.pollCheck);
}, 1000); // each second

// send to uptime kuma (only for production bot)
if (this.client.tokens.status) {
setInterval(() =>
fetch(this.client.tokens.status + this.client.ws.ping).catch(()=>{}),
600000); // 10 minutes
}
}

private pollCheck(p: Poll): void {
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export interface Tokens {
dev: boolean; // if true: instantiate command only it the bot dev discord server
verbose: boolean; // show extra logs for debugging
maintenance: boolean; // if true: disallow normal bot functions and update status
status?: string; // optionally specify a url to post the bot status to
}

0 comments on commit f59322b

Please sign in to comment.