From 520928d4aa1093803c94f353d1f4a6a45a169b77 Mon Sep 17 00:00:00 2001 From: Taken Date: Sun, 13 Oct 2024 20:13:48 +0200 Subject: [PATCH] Added script to update bot --- .env.example | 3 +++ scripts/updatebot.ts | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 scripts/updatebot.ts diff --git a/.env.example b/.env.example index c31f731..e5e186f 100644 --- a/.env.example +++ b/.env.example @@ -8,3 +8,6 @@ DEVTOKEN= CLIENTID= DEVID= GUILDID= +# watchtower +WATCHTOWERTOKEN= +WATCHTOWERURL= diff --git a/scripts/updatebot.ts b/scripts/updatebot.ts new file mode 100644 index 0000000..d5b51d0 --- /dev/null +++ b/scripts/updatebot.ts @@ -0,0 +1,18 @@ +import axios from "axios" + +const url = process.env.WATCHTOWERURL +const token = process.env.WATCHTOWERTOKEN + +if (!url || !token) { + throw new Error("Missing WATCHTOWERURL or WATCHTOWERTOKEN") +} + +await axios.get(url, { + headers: { + Authorization: `Bearer ${token}` + } +}).then(() => { + console.log("Illegitimate bot updated") +}).catch(err => { + console.error("Error updating bot", err) +})