Skip to content

Commit 2d0ba3f

Browse files
committed
fix: negative deposit fix
1 parent 565108a commit 2d0ba3f

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

cogs/economy.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ async def parse_amount(ctx, amount, bank=False):
152152
)
153153
return await ctx.reply(embed=embed)
154154
return econ * (float(amount.replace("%", "")) / 100)
155+
elif amount.lower() in ["a", "all", "everything", "max"]:
156+
amount = user["economy"]["bank"]
157+
return amount
155158
elif "k" in amount.lower() or "thousand" in amount.lower():
156159
return 1000 * int(amount.replace("k", "").replace("thousand", "").replace(" ", ""))
157160
elif "m" in amount.lower() or "mil" in amount.lower() or "million" in amount.lower():
@@ -528,8 +531,10 @@ async def richest(ctx):
528531
@limiter(10, on_ratelimited=lambda ctx, delay, *_1, **_2: ctx.send(f"You're on cooldown! Please wait `{round(delay, 2)}s`!"))
529532
async def deposit(ctx, *, amount: str):
530533
if (await userdb.find_one({"userid": ctx.author.id})):
531-
amt = await parse_amount(ctx, amount, False)
534+
amt = (await parse_amount(ctx, amount, False))
532535
if amt is None:
536+
print(amt)
537+
print(amount)
533538
embed = voltage.SendableEmbed(
534539
title=ctx.author.display_name,
535540
icon_url=ctx.author.display_avatar.url,
@@ -538,6 +543,14 @@ async def deposit(ctx, *, amount: str):
538543
)
539544
await ctx.reply(embed=embed)
540545
return
546+
elif amt < 0:
547+
embed = voltage.SendableEmbed(
548+
title=ctx.author.display_name,
549+
icon_url=ctx.author.display_avatar.url,
550+
description="Please enter a valid amount!",
551+
color="#FF0000",
552+
)
553+
return await ctx.reply(embed=embed)
541554
userdata = (await userdb.find_one({"userid": ctx.author.id}))["economy"]["wallet"]
542555
if userdata > 0:
543556
if amt > userdata:

0 commit comments

Comments
 (0)