diff --git a/.env.template b/.env.template index 2448e78..e372718 100644 --- a/.env.template +++ b/.env.template @@ -12,4 +12,5 @@ BOT_PREFIX=v! FOLDERS_COMMANDS=commands FOLDERS_EVENTS=events -COMMANDS_DISABLED= \ No newline at end of file +COMMANDS_DISABLED= +COMMANDS_DISABLED_MESSAGE=This command is disabled. \ No newline at end of file diff --git a/README.md b/README.md index 4f94096..68fa801 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ FOLDERS_COMMANDS=commands FOLDERS_EVENTS=events COMMANDS_DISABLED= +COMMANDS_DISABLED_MESSAGE=This command is disabled. ``` * **BOT_TOKEN:** Your bot's token, replace {TOKEN} with your bot token. @@ -23,6 +24,7 @@ COMMANDS_DISABLED= * **FOLDERS_COMMANDS:** The folder which contains your commands. * **FOLDERS_EVENTS:** The folder which contains your events. * **COMMANDS_DISABLED:** List of command file names that won't run, separated by commas. +* **COMMANDS_DISABLED_MESSAGE:** The message which is replied to the user who tries to run a disabled command. Make sure that you **DO NOT** put your .env file into VCS! diff --git a/src/client/client.ts b/src/client/client.ts index 9337496..2eb5a37 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -21,6 +21,7 @@ export class CoreClient extends Client { if (!process.env.BOT_PREFIX) throw "BOT_PREFIX is not defined in .env"; if (!process.env.FOLDERS_COMMANDS) throw "FOLDERS_COMMANDS is not defined in .env"; if (!process.env.FOLDERS_EVENTS) throw "FOLDERS_EVENTS is not defined in .env"; + if (!process.env.COMMANDS_DISABLED_MESSAGE) throw "COMMANDS_DISABLED_MESSAGE is not defined in .env"; super.on("message", this._events.onMessage); super.on("ready", this._events.onReady); diff --git a/src/client/util.ts b/src/client/util.ts index e1e1e58..bc675e0 100644 --- a/src/client/util.ts +++ b/src/client/util.ts @@ -25,6 +25,8 @@ export class Util { const disabledCommands = process.env.COMMANDS_DISABLED?.split(','); if (disabledCommands?.find(x => x == name)) { + message.reply(process.env.COMMANDS_DISABLED_MESSAGE || "This command is disabled."); + return { valid: false, message: "Command is disabled",