-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrash.ts
39 lines (36 loc) · 1.09 KB
/
crash.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { Webhook, Embed } from "./imports/harmony.ts";
const createInstance = () => {
return Deno.run({
cmd: "deno run --import-map=imports.json --allow-net --allow-env --allow-read --allow-write --allow-run --no-check mod.ts".split(
" "
),
});
};
let webhook: Webhook | undefined = undefined;
if (Deno.env.get("WEBHOOK_URL") != undefined) {
webhook = await Webhook.fromURL(Deno.env.get("WEBHOOK_URL") as string);
webhook.name = "Bidome Crash Handler";
webhook.avatar =
"https://cdn.discordapp.com/avatars/778670182956531773/75fdc201ce942f628a61f9022db406dc.png?size=1024";
}
while (true) {
const instance = createInstance();
await instance.status();
await instance.close();
if (webhook != undefined) {
webhook.send({
embeds: [
new Embed({
author: {
name: "Not Bidome Crash Handler",
icon_url:
"https://cdn.discordapp.com/avatars/778670182956531773/75fdc201ce942f628a61f9022db406dc.png?size=1024",
},
title: "Bidome offline!",
description:
"The deno process has been killed. Starting a new one...",
}).setColor("random"),
],
});
}
}