Use blueprint directly for commands for clarity

This commit is contained in:
Dragory 2020-07-05 15:03:51 +03:00
parent 05693455ec
commit 9963a4d5a4
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
4 changed files with 34 additions and 40 deletions

View file

@ -5,22 +5,20 @@ import { chunkArray, sorter, trimLines } from "../../../utils";
import { refreshMembersIfNeeded } from "../refreshMembers";
import { sendErrorMessage } from "../../../pluginUtils";
export const RolesCmd = utilityCmd(
"roles",
{
export const RolesCmd = utilityCmd({
trigger: "roles",
description: "List all roles or roles matching a search",
usage: "!roles mod",
permission: "can_roles",
signature: {
search: t.string({ catchAll: true }),
counts: t.switchOption(),
sort: t.string({ option: true }),
},
{
description: "List all roles or roles matching a search",
usage: "!roles mod",
permission: "can_roles",
},
async ({ message: msg, args, pluginData }) => {
async run({ message: msg, args, pluginData }) {
const { guild } = pluginData;
let roles: Array<{ _memberCount?: number } & Role> = Array.from((msg.channel as TextChannel).guild.roles.values());
@ -109,5 +107,5 @@ export const RolesCmd = utilityCmd(
msg.channel.createMessage("```py\n" + roleLines.join("\n") + "```");
}
}
}
);
},
});