From 143a055906dfba13323a21c3b0d9f854c0ca28d7 Mon Sep 17 00:00:00 2001 From: Maseshi Date: Thu, 13 Apr 2023 20:44:12 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=81=20UPDATE:=20Verifying=20environmen?= =?UTF-8?q?t=20readiness.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/handlers/monitor.js | 13 +++++++++++++ source/utils/clientUtils.js | 15 +++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/source/handlers/monitor.js b/source/handlers/monitor.js index 9b234a50..4b600f02 100644 --- a/source/handlers/monitor.js +++ b/source/handlers/monitor.js @@ -63,6 +63,19 @@ module.exports = (client) => { // Initial call to start submitting data. if (client.mode === "start" && enable) { + if (!apiKey) return client.console.fail("monitor-loading", { + "text": "The monitor API Key was not found in the environment. Opt out of sending performance data.", + "failColor": "yellowBright" + }); + if (!pageId) return client.console.fail("monitor-loading", { + "text": "The monitor page ID was not found in the environment. Opt out of sending performance data.", + "failColor": "yellowBright" + }); + if (!metricId) return client.console.fail("monitor-loading", { + "text": "The monitor metric ID was not found in the environment. Opt out of sending performance data.", + "failColor": "yellowBright" + }); + client.console.add("monitor-loading", { "text": "Preparing to send data to matrix" }); diff --git a/source/utils/clientUtils.js b/source/utils/clientUtils.js index f7ae141e..7d6d4f09 100644 --- a/source/utils/clientUtils.js +++ b/source/utils/clientUtils.js @@ -75,10 +75,17 @@ const updateApplicationCommands = async (client, reload = false) => { { "body": data } ); } else { - await rest.put( - Routes.applicationGuildCommands(clientID, guildID), - { "body": data } - ); + if (guildID) { + await rest.put( + Routes.applicationGuildCommands(clientID, guildID), + { "body": data } + ); + } else { + client.console.fail("app-commands-loading", { + "text": "The testGuild key was not found in the environment. You may not be able to see recent commands.", + "status": "non-spinnable" + }); + } } if (!reload) { client.console.update("app-commands-loading", {