MCPcopy Create free account
hub / github.com/esmBot/esmBot / run

Method run

commands/general/command/enable.js:5–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3
4class CommandEnableCommand extends Command {
5 async run() {
6 this.success = false;
7 if (!this.guild) return this.getString("guildOnly");
8 if (!this.database) return this.getString("noDatabase");
9 const owners = process.env.OWNER?.split(",") ?? [];
10 if (!this.memberPermissions.has("ADMINISTRATOR") && !owners.includes(this.author.id))
11 return this.getString("commands.responses.command.adminOnly");
12
13 const commandName = this.getOptionString("cmd", true)?.toLowerCase();
14 if (!commandName) return this.getString("commands.responses.command.noInput");
15 if (!commands.has(commandName.split(" ")[0]) && !aliases.has(commandName))
16 return this.getString("commands.responses.command.invalidCmd");
17
18 const guildDB = await this.database.getGuild(this.guild.id);
19 const command = aliases.get(commandName) ?? commandName;
20
21 if (!guildDB.disabled_commands.includes(command)) return this.getString("commands.responses.command.notDisabled");
22
23 await this.database.enableCommand(this.guild.id, command);
24 this.success = true;
25 return this.getString("commands.responses.command.reEnabled", { params: { command } });
26 }
27
28 static description = "Enables a classic command";
29 static flags = [

Callers

nothing calls this directly

Calls 4

getStringMethod · 0.80
getOptionStringMethod · 0.80
getGuildMethod · 0.45
enableCommandMethod · 0.45

Tested by

no test coverage detected