Implement push monitoring

This commit is contained in:
2023-09-16 15:33:16 +02:00
parent 3594c2ea8c
commit c6a4577872
7 changed files with 425 additions and 197 deletions

View File

@ -1,6 +1,7 @@
import { runCleanup } from "../service";
import client from "./index";
import { initPromise } from "../data/dataSource";
import pushMonitor from "@astrogd/eu.astrogd.uptime-kuma-push-monitor";
const token = process.env["TOKEN"];
if (!token) throw new ReferenceError("TOKEN environment variable is missing");
@ -14,6 +15,9 @@ async function run() {
client.on("ready", async () => {
console.log(`Connected to Discord API. Bot account is ${client.user?.tag} (${client.user?.id})`);
if (process.env["MONITOR_URL"]) pushMonitor.register(process.env["MONITOR_URL"], 120);
pushMonitor.enableShutdownNotifications();
pushMonitor.setPerformanceHandler(() => client.ws.ping);
runCleanup();
});