diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-06-16 14:32:18 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-06-16 14:32:18 -0400 |
commit | 0e87bbd3940d89defcb04926587b35c8f4d1947f (patch) | |
tree | e50860d4dc25a11d4c3977b583284c4bcad1b077 /src/commands/utilities/whoHasRole.ts | |
parent | 661e4c9935aeb8760dafc7ced4bbec6cc356a033 (diff) | |
download | tanzanite-0e87bbd3940d89defcb04926587b35c8f4d1947f.tar.gz tanzanite-0e87bbd3940d89defcb04926587b35c8f4d1947f.tar.bz2 tanzanite-0e87bbd3940d89defcb04926587b35c8f4d1947f.zip |
remove util classes, move config out of src
Diffstat (limited to 'src/commands/utilities/whoHasRole.ts')
-rw-r--r-- | src/commands/utilities/whoHasRole.ts | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/commands/utilities/whoHasRole.ts b/src/commands/utilities/whoHasRole.ts index ae96a65..851411a 100644 --- a/src/commands/utilities/whoHasRole.ts +++ b/src/commands/utilities/whoHasRole.ts @@ -1,6 +1,17 @@ -import { BushCommand, ButtonPaginator, OptArgType, type CommandMessage, type SlashMessage } from '#lib'; +import { + BushCommand, + ButtonPaginator, + chunk, + clientSendAndPermCheck, + colors, + emojis, + OptArgType, + oxford, + type CommandMessage, + type SlashMessage +} from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, Util, type CommandInteraction, type Role } from 'discord.js'; +import { ApplicationCommandOptionType, escapeMarkdown, type CommandInteraction, type Role } from 'discord.js'; export default class WhoHasRoleCommand extends BushCommand { public constructor() { @@ -24,7 +35,7 @@ export default class WhoHasRoleCommand extends BushCommand { ), slash: true, channel: 'guild', - clientPermissions: (m) => util.clientSendAndPermCheck(m), + clientPermissions: (m) => clientSendAndPermCheck(m), userPermissions: [], typing: true }); @@ -44,18 +55,18 @@ export default class WhoHasRoleCommand extends BushCommand { const members = message.guild.members.cache.filter((m) => roles.every((r) => m.roles.cache.has(r))); - const roleMembers = members.map((member) => `${member.user} (${Util.escapeMarkdown(member.user.tag)})`); - const chunkedRoleMembers = util.chunk(roleMembers, 30); + const roleMembers = members.map((member) => `${member.user} (${escapeMarkdown(member.user.tag)})`); + const chunkedRoleMembers = chunk(roleMembers, 30); const title = `Members with ${ roles.length < 4 - ? util.oxford( + ? oxford( rawRoles.map((r) => r.name), 'and' ) : `${rawRoles.length} Roles` } [\`${members.size.toLocaleString()}\`]`; - const color = util.colors.default; + const color = colors.default; const embedPages = chunkedRoleMembers.map((chunk) => ({ title, description: chunk.join('\n'), @@ -63,7 +74,7 @@ export default class WhoHasRoleCommand extends BushCommand { })); if (embedPages.length === 0) { - return await message.util.reply(`${util.emojis.error} No members found matching the given roles.`); + return await message.util.reply(`${emojis.error} No members found matching the given roles.`); } return await ButtonPaginator.send(message, embedPages, null, true); |