diff --git a/package.json b/package.json index 90c05c9..90a3083 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "mongoose": "^5.9.13", "nodemailer": "^6.4.8", "pluris": "^0.2.5", + "sd-notify": "^2.8.0", "signale": "^1.4.0", "stripe": "^8.120.0", "uuid": "^8.0.0", diff --git a/src/main.ts b/src/main.ts index c1ef0dd..fb19c4b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,7 @@ /* DM Ramirez with the code below to claim 500 free Rubies! d2c3d8e14b */ +import sdNotify from 'sd-notify'; import { parse } from 'yaml'; import { promises as fs } from 'fs'; import { Client } from './class'; @@ -9,6 +10,8 @@ import * as commandFiles from './commands'; import { Config } from '../types'; // eslint-disable-line async function main(): Promise { + sdNotify.ready(); + sdNotify.startWatchdogMode(2500); const read = await fs.readFile('../config.yaml', 'utf8'); const config: Config = parse(read); const client = new Client(config.token, { defaultImageFormat: 'png', restMode: true, intents: ['guildBans', 'guildEmojis', 'guildInvites', 'guildMembers', 'guildMessageReactions', 'guildMessages', 'guildPresences', 'guildWebhooks', 'guilds', 'directMessages'] }); diff --git a/types/sdNotify.d.ts b/types/sdNotify.d.ts new file mode 100644 index 0000000..82258c3 --- /dev/null +++ b/types/sdNotify.d.ts @@ -0,0 +1,5 @@ +declare module 'sd-notify' { + function ready(): void; + function startWatchdogMode(ms: number): void; + function sendStatus(txt: string): void; +}