diff --git a/backend/src/plugins/Utility/commands/LevelCmd.ts b/backend/src/plugins/Utility/commands/LevelCmd.ts index c917b2ea..7a9a918a 100644 --- a/backend/src/plugins/Utility/commands/LevelCmd.ts +++ b/backend/src/plugins/Utility/commands/LevelCmd.ts @@ -4,20 +4,18 @@ import { helpers } from "knub"; const { getMemberLevel } = helpers; -export const LevelCmd = utilityCmd( - "level", - { +export const LevelCmd = utilityCmd({ + trigger: "level", + description: "Show the permission level of a user", + usage: "!level 106391128718245888", + + signature: { member: ct.resolvedMember({ required: false }), }, - { - description: "Show the permission level of a user", - usage: "!level 106391128718245888", - }, - - ({ message, args, pluginData }) => { + run({ message, args, pluginData }) { const member = args.member || message.member; const level = getMemberLevel(pluginData, member); message.channel.createMessage(`The permission level of ${member.username}#${member.discriminator} is **${level}**`); } -); +}); diff --git a/backend/src/plugins/Utility/commands/RolesCmd.ts b/backend/src/plugins/Utility/commands/RolesCmd.ts index 482c614c..e6f515d4 100644 --- a/backend/src/plugins/Utility/commands/RolesCmd.ts +++ b/backend/src/plugins/Utility/commands/RolesCmd.ts @@ -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") + "```"); } } - } -); + }, +}); diff --git a/backend/src/plugins/Utility/commands/SearchCmd.ts b/backend/src/plugins/Utility/commands/SearchCmd.ts index f6f16a69..78e49ae4 100644 --- a/backend/src/plugins/Utility/commands/SearchCmd.ts +++ b/backend/src/plugins/Utility/commands/SearchCmd.ts @@ -1,12 +1,14 @@ import { utilityCmd } from "../types"; import { baseTypeHelpers as t } from "knub"; -export const SearchCmd = utilityCmd( - ["search", "s"], - { +export const SearchCmd = utilityCmd({ + trigger: ["search", "s"], + + signature: { query: t.string({ catchAll: true }), + }, + + run() { }, - {}, - () => {} -); +}); diff --git a/backend/src/plugins/Utility/commands/ServerCmd.ts b/backend/src/plugins/Utility/commands/ServerCmd.ts index 718a8c86..24f20904 100644 --- a/backend/src/plugins/Utility/commands/ServerCmd.ts +++ b/backend/src/plugins/Utility/commands/ServerCmd.ts @@ -4,17 +4,13 @@ import { embedPadding, formatNumber, memoize, MINUTES, trimLines } from "../../. import { utilityCmd } from "../types"; import humanizeDuration from "humanize-duration"; -export const ServerCmd = utilityCmd( - "server", - {}, +export const ServerCmd = utilityCmd({ + trigger: "server", + description: "Show information about the server", + usage: "!server", + permission: "can_server", - { - permission: "can_server", - description: "Show information about the server", - usage: "!server", - }, - - async ({ message }) => { + async run({ message }) { const embed: EmbedOptions = { fields: [], color: parseInt("6b80cf", 16), @@ -122,5 +118,5 @@ export const ServerCmd = utilityCmd( }); message.channel.createMessage({ embed }); - } -); + }, +});