aboutsummaryrefslogtreecommitdiff
path: root/src/commands/leveling/setXp.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-16 14:32:18 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-16 14:32:18 -0400
commit0e87bbd3940d89defcb04926587b35c8f4d1947f (patch)
treee50860d4dc25a11d4c3977b583284c4bcad1b077 /src/commands/leveling/setXp.ts
parent661e4c9935aeb8760dafc7ced4bbec6cc356a033 (diff)
downloadtanzanite-0e87bbd3940d89defcb04926587b35c8f4d1947f.tar.gz
tanzanite-0e87bbd3940d89defcb04926587b35c8f4d1947f.tar.bz2
tanzanite-0e87bbd3940d89defcb04926587b35c8f4d1947f.zip
remove util classes, move config out of src
Diffstat (limited to 'src/commands/leveling/setXp.ts')
-rw-r--r--src/commands/leveling/setXp.ts24
1 files changed, 17 insertions, 7 deletions
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()
});
}