From 0e87bbd3940d89defcb04926587b35c8f4d1947f Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Thu, 16 Jun 2022 14:32:18 -0400 Subject: remove util classes, move config out of src --- src/commands/leveling/leaderboard.ts | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/commands/leveling/leaderboard.ts') diff --git a/src/commands/leveling/leaderboard.ts b/src/commands/leveling/leaderboard.ts index 040ed4a..d81d88b 100644 --- a/src/commands/leveling/leaderboard.ts +++ b/src/commands/leveling/leaderboard.ts @@ -1,4 +1,15 @@ -import { BushCommand, ButtonPaginator, Level, type CommandMessage, type OptArgType, type SlashMessage } from '#lib'; +import { + BushCommand, + ButtonPaginator, + chunk, + clientSendAndPermCheck, + emojis, + Level, + prefix, + type CommandMessage, + type OptArgType, + type SlashMessage +} from '#lib'; import assert from 'assert'; import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; @@ -23,7 +34,7 @@ export default class LeaderboardCommand extends BushCommand { ], slash: true, channel: 'guild', - clientPermissions: (m) => util.clientSendAndPermCheck(m), + clientPermissions: (m) => clientSendAndPermCheck(m), userPermissions: [] }); } @@ -33,9 +44,9 @@ export default class LeaderboardCommand extends BushCommand { if (!(await message.guild.hasFeature('leveling'))) return await message.util.reply( - `${util.emojis.error} This command can only be run in servers with the leveling feature enabled.${ + `${emojis.error} This command can only be run in servers with the leveling feature enabled.${ message.member?.permissions.has(PermissionFlagsBits.ManageGuild) - ? ` You can toggle features using the \`${util.prefix(message)}features\` command.` + ? ` You can toggle features using the \`${prefix(message)}features\` command.` : '' }` ); @@ -44,7 +55,7 @@ export default class LeaderboardCommand extends BushCommand { const mappedRanks = ranks.map( (val, index) => `\`${index + 1}\` <@${val.user}> - Level ${val.level} (${val.xp.toLocaleString()} xp)` ); - const chunked = util.chunk(mappedRanks, 25); + const chunked = chunk(mappedRanks, 25); const embeds = chunked.map((c) => new EmbedBuilder().setTitle(`${message.guild.name}'s Leaderboard`).setDescription(c.join('\n')) ); -- cgit