Implement push monitoring
This commit is contained in:
@ -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();
|
||||
});
|
||||
|
@ -1,4 +1,3 @@
|
||||
import "./uptime";
|
||||
import runCleanup from "./cleanup";
|
||||
|
||||
export {
|
||||
|
@ -1,19 +0,0 @@
|
||||
import express from "express";
|
||||
import pack from "../../package.json";
|
||||
import startupTime from "../tools/startupTime";
|
||||
|
||||
const app = express();
|
||||
|
||||
app.get("/", (_req, res) => {
|
||||
res.status(200).json({
|
||||
running: true,
|
||||
version: pack.version,
|
||||
runningSince: startupTime.toISOString()
|
||||
});
|
||||
});
|
||||
|
||||
app.all("*", (_req, res) => {
|
||||
res.status(404).end();
|
||||
});
|
||||
|
||||
app.listen(80);
|
Reference in New Issue
Block a user