mirror of
https://gitlab.com/qwerinope/qweribot.git
synced 2026-02-04 09:26:58 +01:00
proper formatting and linting YAY, change cheer constructor to take object
This commit is contained in:
@@ -1,30 +1,51 @@
|
||||
import { redis } from "lib/redis";
|
||||
import { Command, sendMessage } from "lib/commandUtils";
|
||||
import { basecommands } from "commands";
|
||||
import { Command, sendMessage } from "lib/commandUtils";
|
||||
import parseCommandArgs from "lib/parseCommandArgs";
|
||||
import { redis } from "lib/redis";
|
||||
|
||||
export default new Command({
|
||||
name: 'getcommands',
|
||||
aliases: ['getcommands', 'getc', 'commands'],
|
||||
usertype: 'chatter',
|
||||
disableable: false,
|
||||
execution: async msg => {
|
||||
const args = parseCommandArgs(msg.messageText);
|
||||
if (!args[0]) { await sendMessage(`A full list of commands can be found here: https://github.com/qwerinope/qweribot#commands-1`, msg.messageId); return; };
|
||||
const disabledcommands = await redis.smembers('disabledcommands');
|
||||
if (args[0].toLowerCase() === 'enabled') {
|
||||
const commandnames: string[] = [];
|
||||
for (const [name, command] of Array.from(basecommands.entries())) {
|
||||
if (command.usertype !== 'chatter') continue; // Admin only commands should be somewhat hidden
|
||||
if (disabledcommands.includes(name)) continue;
|
||||
commandnames.push(name);
|
||||
};
|
||||
if (commandnames.length === 0) await sendMessage('No commands besides non-disableable commands are enabled', msg.messageId);
|
||||
else await sendMessage(`Currently enabled commands: ${commandnames.join(', ')}`, msg.messageId);
|
||||
} else if (args[0].toLowerCase() === 'disabled') {
|
||||
if (disabledcommands.length === 0) await sendMessage('No commands are disabled', msg.messageId);
|
||||
else await sendMessage(`Currently disabled commands: ${disabledcommands.join(', ')}`);
|
||||
}
|
||||
else await sendMessage('Please specify if you want the enabled or disabled commands', msg.messageId);
|
||||
}
|
||||
name: "getcommands",
|
||||
aliases: ["getcommands", "getc", "commands"],
|
||||
usertype: "chatter",
|
||||
disableable: false,
|
||||
execution: async (msg) => {
|
||||
const args = parseCommandArgs(msg.messageText);
|
||||
if (!args[0]) {
|
||||
await sendMessage(
|
||||
`A full list of commands can be found here: https://github.com/qwerinope/qweribot#commands-1`,
|
||||
msg.messageId,
|
||||
);
|
||||
return;
|
||||
}
|
||||
const disabledcommands = await redis.smembers("disabledcommands");
|
||||
if (args[0].toLowerCase() === "enabled") {
|
||||
const commandnames: string[] = [];
|
||||
for (const [name, command] of Array.from(basecommands.entries())) {
|
||||
if (command.usertype !== "chatter") continue; // Admin only commands should be somewhat hidden
|
||||
if (disabledcommands.includes(name)) continue;
|
||||
commandnames.push(name);
|
||||
}
|
||||
if (commandnames.length === 0)
|
||||
await sendMessage(
|
||||
"No commands besides non-disableable commands are enabled",
|
||||
msg.messageId,
|
||||
);
|
||||
else
|
||||
await sendMessage(
|
||||
`Currently enabled commands: ${commandnames.join(", ")}`,
|
||||
msg.messageId,
|
||||
);
|
||||
} else if (args[0].toLowerCase() === "disabled") {
|
||||
if (disabledcommands.length === 0)
|
||||
await sendMessage("No commands are disabled", msg.messageId);
|
||||
else
|
||||
await sendMessage(
|
||||
`Currently disabled commands: ${disabledcommands.join(", ")}`,
|
||||
);
|
||||
} else
|
||||
await sendMessage(
|
||||
"Please specify if you want the enabled or disabled commands",
|
||||
msg.messageId,
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user