From 55ba970bb4492dffaa03fe04fed230ef8dfb4480 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Wed, 11 May 2022 21:49:50 +0300 Subject: [PATCH] development mode --- options.json | 1 + src/structure/DiscordClient.js | 8 ++++++++ src/structure/components/observers/CommandHandler.js | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/options.json b/options.json index f798272..638d745 100644 --- a/options.json +++ b/options.json @@ -5,6 +5,7 @@ "132620781791346688", "132777808362471424" ], + "developmentMode": true, "clientOptions": { "commentedOut": ["GUILD_PRESENCES","REACTION","MESSAGE","USER"], "partials": [ diff --git a/src/structure/DiscordClient.js b/src/structure/DiscordClient.js index ec12173..bc87f59 100644 --- a/src/structure/DiscordClient.js +++ b/src/structure/DiscordClient.js @@ -326,6 +326,14 @@ class DiscordClient extends Client { return this.moderationManager; } + get developers() { + return this._options.discord.developers; + } + + get developmentMode() { + return this._options.discord.developmentMode; + } + } // module.exports = DiscordClient; diff --git a/src/structure/components/observers/CommandHandler.js b/src/structure/components/observers/CommandHandler.js index ff3b7d8..ac3234e 100644 --- a/src/structure/components/observers/CommandHandler.js +++ b/src/structure/components/observers/CommandHandler.js @@ -129,6 +129,11 @@ class CommandHandler extends Observer { let response = null; const now = Date.now(); + if (this.client.developmentMode && !this.client.developers.includes(invoker.user.id)) return invoker.reply({ + content: 'Bot is in development mode currently and is online for stability testing.\nIt\'ll be ready for public use soon!', + ephemeral: true + }); + try { this.logger.info(`${invoker.user.tag} (${invoker.user.id}) is executing ${invoker.command.name} in ${invoker.guild?.name || 'dms'}`); response = await invoker.command.execute(invoker, options);