Something went wrong. Try again.
A Discord bot designed to entertain your server esmbot.net
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354import Command from "#cmd-classes/command.js";import { aliases, commands } from "#utils/collections.js";import { getEnv } from "#utils/runtime.js";/** @import { CommandFlag } from "#utils/types.js" */
class CommandDisableCommand extends Command { async run() { this.success = false; if (!this.guild) return this.getString("guildOnly"); if (!this.database) return this.getString("noDatabase"); const owners = getEnv("OWNER")?.split(",") ?? []; if (!this.memberPermissions.has("ADMINISTRATOR") && !owners.includes(this.author.id)) return this.getString("commands.responses.command.adminOnly");
const commandName = this.getOptionString("cmd", true)?.toLowerCase(); if (!commandName) return this.getString("commands.responses.command.noInput"); if (!commands.has(commandName.split(" ")[0]) && !aliases.has(commandName)) return this.getString("commands.responses.command.invalidCmd");
const guildDB = await this.database.getGuild(this.guild.id); const command = aliases.get(commandName) ?? commandName;
if (command === "command") return this.getString("commands.responses.command.cannotDisable"); if (guildDB.disabled_commands.includes(command)) return this.getString("commands.responses.command.alreadyDisabled");
await this.database.disableCommand(this.guild.id, command); this.success = true; return this.getString("commands.responses.command.disabled", { params: { command, prefix: guildDB.prefix, }, }); }
static description = "Disables a classic command"; /** @type {CommandFlag[]} */ static flags = [ { name: "cmd", type: "string", description: "The command to disable", classic: true, required: true, }, ]; static slashAllowed = false; static directAllowed = false; static dbRequired = true;}
export default CommandDisableCommand;