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/setXp.ts | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src/commands/leveling/setXp.ts') diff --git a/src/commands/leveling/setXp.ts b/src/commands/leveling/setXp.ts index 60e0b94..96b3ad7 100644 --- a/src/commands/leveling/setXp.ts +++ b/src/commands/leveling/setXp.ts @@ -1,4 +1,14 @@ -import { AllowedMentions, BushCommand, Level, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; +import { + AllowedMentions, + BushCommand, + clientSendAndPermCheck, + emojis, + format, + Level, + type ArgType, + type CommandMessage, + type SlashMessage +} from '#lib'; import assert from 'assert'; import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; @@ -31,7 +41,7 @@ export default class SetXpCommand extends BushCommand { ], slash: true, channel: 'guild', - clientPermissions: (m) => util.clientSendAndPermCheck(m), + clientPermissions: (m) => clientSendAndPermCheck(m), userPermissions: [PermissionFlagsBits.Administrator] }); } @@ -43,10 +53,10 @@ export default class SetXpCommand extends BushCommand { assert(message.inGuild()); assert(user.id); - if (isNaN(xp)) return await message.util.reply(`${util.emojis.error} Provide a valid number.`); + if (isNaN(xp)) return await message.util.reply(`${emojis.error} Provide a valid number.`); if (xp > 2147483647 || xp < 0) return await message.util.reply( - `${util.emojis.error} Provide an positive integer under **2,147,483,647** to set the user's xp to.` + `${emojis.error} Provide an positive integer under **2,147,483,647** to set the user's xp to.` ); const [levelEntry] = await Level.findOrBuild({ @@ -57,9 +67,9 @@ export default class SetXpCommand extends BushCommand { await levelEntry.update({ xp: xp, user: user.id, guild: message.guild.id }); return await message.util.send({ - content: `Successfully set <@${user.id}>'s xp to ${util.format.input( - levelEntry.xp.toLocaleString() - )} (level ${util.format.input(Level.convertXpToLevel(levelEntry.xp).toLocaleString())}).`, + content: `Successfully set <@${user.id}>'s xp to ${format.input(levelEntry.xp.toLocaleString())} (level ${format.input( + Level.convertXpToLevel(levelEntry.xp).toLocaleString() + )}).`, allowedMentions: AllowedMentions.none() }); } -- cgit