diff options
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); |