aboutsummaryrefslogtreecommitdiff
path: root/src/commands/leveling/setLevel.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/leveling/setLevel.ts')
-rw-r--r--src/commands/leveling/setLevel.ts20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/commands/leveling/setLevel.ts b/src/commands/leveling/setLevel.ts
index 8abdb57..b1d9516 100644
--- a/src/commands/leveling/setLevel.ts
+++ b/src/commands/leveling/setLevel.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';
@@ -30,7 +40,7 @@ export default class SetLevelCommand extends BushCommand {
],
slash: true,
channel: 'guild',
- clientPermissions: (m) => util.clientSendAndPermCheck(m),
+ clientPermissions: (m) => clientSendAndPermCheck(m),
userPermissions: [PermissionFlagsBits.Administrator]
});
}
@@ -43,9 +53,9 @@ export default class SetLevelCommand extends BushCommand {
assert(user.id);
if (isNaN(level) || !Number.isInteger(level))
- return await message.util.reply(`${util.emojis.error} Provide a valid number to set the user's level to.`);
+ return await message.util.reply(`${emojis.error} Provide a valid number to set the user's level to.`);
if (level > 6553 || level < 0)
- return await message.util.reply(`${util.emojis.error} You cannot set a level higher than **6,553**.`);
+ return await message.util.reply(`${emojis.error} You cannot set a level higher than **6,553**.`);
const [levelEntry] = await Level.findOrBuild({
where: { user: user.id, guild: message.guild.id },
@@ -53,7 +63,7 @@ export default class SetLevelCommand extends BushCommand {
});
await levelEntry.update({ xp: Level.convertLevelToXp(level), user: user.id, guild: message.guild.id });
return await message.util.send({
- content: `Successfully set level of <@${user.id}> to ${util.format.input(level.toLocaleString())} (${util.format.input(
+ content: `Successfully set level of <@${user.id}> to ${format.input(level.toLocaleString())} (${format.input(
levelEntry.xp.toLocaleString()
)} XP)`,
allowedMentions: AllowedMentions.none()