Skip to content

Commit 619c61b

Browse files
committed
LevelUp - ensure someone cant set a level too high
1 parent 61db6ae commit 619c61b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

levelup/commands/admin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,9 @@ async def set_level(self, ctx: commands.Context, user: discord.Member, level: in
531531
profile = conf.get_profile(user)
532532
profile.level = level
533533
profile.xp = conf.algorithm.get_xp(level)
534+
# Make sure xp is a valid number that python can actually handle
535+
if profile.xp > 1e308:
536+
return await ctx.send(_("That level is too high!"))
534537
self.save()
535538
reason = _("{} set {}'s level to {}").format(ctx.author.name, user.name, level)
536539
added, removed = await self.ensure_roles(user, conf, reason)

levelup/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class LevelUp(
7777
"""
7878

7979
__author__ = "[vertyco](https://github.com/vertyco/vrt-cogs)"
80-
__version__ = "4.3.20"
80+
__version__ = "4.3.21"
8181
__contributors__ = [
8282
"[aikaterna](https://github.com/aikaterna/aikaterna-cogs)",
8383
"[AAA3A](https://github.com/AAA3A-AAA3A/AAA3A-cogs)",

0 commit comments

Comments
 (0)