Skip to content

Commit

Permalink
fix: add check to make sure balances don't overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
AstreaTSS committed Jan 4, 2025
1 parent 55c55d1 commit 2c91a6d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion exts/gacha/gacha_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ async def gacha_give_all(

if not ctx.guild.chunked:
await ctx.guild.chunk()
await asyncio.sleep(1) # sometimes, it needs the wiggle room
await asyncio.sleep(1.5) # sometimes, it needs the wiggle room

members = actual_role.members.copy()

Expand All @@ -498,6 +498,12 @@ async def gacha_give_all(
"user_id": {"in": [m.id for m in members]},
},
)
if any(p.currency_amount + amount > 2147483647 for p in existing_players):
raise ipy.errors.BadArgument(
"One or more users would have more than the maximum amount of currency,"
" 2,147,483,647, after this operation."
)

existing_players_set = {p.user_id for p in existing_players}

async with self.bot.db.batch_() as batch:
Expand Down

0 comments on commit 2c91a6d

Please sign in to comment.