Feature/3 disable commands #50

Merged
Vylpes merged 4 commits from feature/3-disable-commands into develop 2021-09-24 19:00:08 +01:00
3 changed files with 19 additions and 5 deletions
Showing only changes of commit 4e1c418246 - Show all commits

View file

@ -10,4 +10,6 @@ BOT_TOKEN=
BOT_PREFIX=v!
FOLDERS_COMMANDS=commands
FOLDERS_EVENTS=events
FOLDERS_EVENTS=events
COMMANDS_DISABLED=

View file

@ -14,12 +14,15 @@ BOT_PREFIX=v!
FOLDERS_COMMANDS=commands
FOLDERS_EVENTS=events
COMMANDS_DISABLED=
```
* **BOT_TOKEN:** Your bot's token, replace {TOKEN} with your bot token
* **BOT_PREFIX** The command prefix
* **FOLDERS_COMMANDS:** The folder which contains your commands
* **FOLDERS_EVENTS** The folder which contains your events
* **BOT_TOKEN:** Your bot's token, replace {TOKEN} with your bot token.
* **BOT_PREFIX:** The command prefix.
* **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.
Make sure that you **DO NOT** put your .env file into VCS!

View file

@ -22,6 +22,15 @@ export class Util {
message: "Member is not part of message",
};
const disabledCommands = process.env.COMMANDS_DISABLED?.split(',');
if (disabledCommands?.find(x => x == name)) {
return {
valid: false,
message: "Command is disabled",
VylpesTester commented 2021-09-24 18:13:59 +01:00 (Migrated from github.com)
Review

When this returns, what it should do is reply to the user also, to say its disabled

When this returns, what it should do is reply to the user also, to say its disabled
};
}
const folder = process.env.FOLDERS_COMMANDS;
if (existsSync(`${process.cwd()}/${folder}/`)) {