Files
qweribot/src/commands/enablecommand.ts

36 lines
972 B
TypeScript

import commands from "commands";
import { Command, sendMessage } from "lib/commandUtils";
import parseCommandArgs from "lib/parseCommandArgs";
import { redis } from "lib/redis";
export default new Command({
name: "enablecommand",
aliases: ["enablecommand"],
usertype: "moderator",
disableable: false,
execution: async (msg) => {
const args = parseCommandArgs(msg.messageText);
if (!args[0]) {
await sendMessage("Please specify a command to enable", msg.messageId);
return;
}
const selection = commands.get(args[0].toLowerCase());
if (!selection) {
await sendMessage(`There is no ${args[0]} command`, msg.messageId);
return;
}
const result = await redis.srem("disabledcommands", selection.name);
if (result === 0) {
await sendMessage(
`The ${selection.name} command isn't disabled`,
msg.messageId,
);
return;
}
await sendMessage(
`Successfully enabled the ${selection.name} command`,
msg.messageId,
);
},
});