diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-09-08 16:02:51 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-09-08 16:02:51 -0400 |
commit | b6d1ac9a60e8b8a967ef3e93b92b9748d1f637f9 (patch) | |
tree | da1b870adc36a1a114d4c61d7695e034fd5abd79 /src/commands/leveling | |
parent | f366181069e1fd4daf7cf379d10c44c25fad84c2 (diff) | |
download | tanzanite-b6d1ac9a60e8b8a967ef3e93b92b9748d1f637f9.tar.gz tanzanite-b6d1ac9a60e8b8a967ef3e93b92b9748d1f637f9.tar.bz2 tanzanite-b6d1ac9a60e8b8a967ef3e93b92b9748d1f637f9.zip |
fix support threads, allow 0 for abreviated numbers, fix accent colors
Diffstat (limited to 'src/commands/leveling')
-rw-r--r-- | src/commands/leveling/level.ts | 1 | ||||
-rw-r--r-- | src/commands/leveling/setLevel.ts | 8 | ||||
-rw-r--r-- | src/commands/leveling/setXp.ts | 6 |
3 files changed, 14 insertions, 1 deletions
diff --git a/src/commands/leveling/level.ts b/src/commands/leveling/level.ts index 223a590..f14c005 100644 --- a/src/commands/leveling/level.ts +++ b/src/commands/leveling/level.ts @@ -60,6 +60,7 @@ export default class LevelCommand extends BushCommand { const currentLevelXP = Level.convertLevelToXp(userLevel); const currentLevelXPProgress = userLevelRow.xp - currentLevelXP; const xpForNextLevel = Level.convertLevelToXp(userLevelRow.level + 1) - currentLevelXP; + await user.fetch(true); // get accent color const white = '#FFFFFF', gray = '#23272A', highlight = user.hexAccentColor ?? '#5865F2'; diff --git a/src/commands/leveling/setLevel.ts b/src/commands/leveling/setLevel.ts index f312356..2cd9099 100644 --- a/src/commands/leveling/setLevel.ts +++ b/src/commands/leveling/setLevel.ts @@ -59,6 +59,11 @@ export default class SetLevelCommand extends BushCommand { return await message.util.reply(`${util.emojis.error} This command is Bestower proof.`); if (!user.id) throw new Error('user.id is null'); + if (isNaN(level)) + return await message.util.reply(`${util.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 \`6553\`.`); + const [levelEntry] = await Level.findOrBuild({ where: { user: user.id, @@ -66,7 +71,8 @@ export default class SetLevelCommand extends BushCommand { }, defaults: { user: user.id, - guild: message.guild.id + guild: message.guild.id, + xp: 0 } }); await levelEntry.update({ xp: Level.convertLevelToXp(level), user: user.id, guild: message.guild.id }); diff --git a/src/commands/leveling/setXp.ts b/src/commands/leveling/setXp.ts index fdfd74f..8be3a10 100644 --- a/src/commands/leveling/setXp.ts +++ b/src/commands/leveling/setXp.ts @@ -62,6 +62,12 @@ export default class SetXpCommand extends BushCommand { return await message.util.reply(`${util.emojis.error} This command is Bestower proof.`); if (!user.id) throw new Error('user.id is null'); + if (isNaN(xp)) return await message.util.reply(`${util.emojis.error} Provide a valid number.`); + if (xp > 2147483647 || xp < 0) + return await message.util.reply( + `${util.emojis.error} Provide an positive integer under \`2147483647\` to set the user's xp to.` + ); + const [levelEntry] = await Level.findOrBuild({ where: { user: user.id, |