Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,17 @@ async def warns_clear(ctx:SlashContext, user):
name='deposit',
description='Deposits a specified amount of cash into the bank.',
options=[
create_option(name='amount', description='Specify an amount to deposit (leave blank for max)', option_type=4, required=False)
create_option(name='amount', description='Specify an amount to deposit (use max for everything)', option_type=3, required=True)
]
)
async def deposit(ctx:SlashContext, amount=None):
async def deposit(ctx:SlashContext, amount):
if plugins.economy:
if amount == None: amount = currency["wallet"][str(ctx.author.id)]
if not amount.isdigit():
if str(amount) == "max": amount = currency["wallet"][str(ctx.author.id)]
else: return await ctx.reply("The amount must be a number, or `max`.", hidden=True)
elif currency['bank'] == 0: return await ctx.reply('You don\'t have anything in your bank account.', hidden=True)
elif amount <= 0: return await ctx.reply('The amount to deposit must be more than `0` coins!', hidden=True)
elif amount > currency["wallet"][str(ctx.author.id)]: return await ctx.reply('The amount to deposit must not be more than what you have in your wallet!', hidden=True)
elif int(amount) <= 0: return await ctx.reply('The amount to deposit must be more than `0` coins!', hidden=True)
elif int(amount) > currency["wallet"][str(ctx.author.id)]: return await ctx.reply('The amount to deposit must not be more than what you have in your wallet!', hidden=True)
currency["wallet"][str(ctx.author.id)] -= int(amount)
currency["bank"][str(ctx.author.id)] += int(amount)
await ctx.send(f'You deposited `{amount}` coin(s) to your bank account.')
Expand All @@ -281,15 +283,17 @@ async def deposit(ctx:SlashContext, amount=None):
name='withdraw',
description='Withdraws a specified amount of cash from the bank.',
options=[
create_option(name='amount', description='Specify an amount to withdraw (leave blank for max)', option_type=4, required=False)
create_option(name='amount', description='Specify an amount to withdraw (use max for everything)', option_type=3, required=True)
]
)
async def withdraw(ctx:SlashContext, amount=None):
async def withdraw(ctx:SlashContext, amount):
if plugins.economy:
if amount == None: amount = currency["bank"][str(ctx.author.id)]
if not amount.isdigit():
if str(amount) == "max": amount = currency["wallet"][str(ctx.author.id)]
else: return await ctx.reply("The amount must be a number, or `max`.", hidden=True)
elif currency['bank'] == 0: return await ctx.reply('You don\'t have anything in your bank account.', hidden=True)
elif amount <= 0: return await ctx.reply('The amount to withdraw must be more than `0` coins!', hidden=True)
elif amount > currency["bank"][str(ctx.author.id)]: return await ctx.reply('The amount to withdraw must not be more than what you have in your bank account!', hidden=True)
elif int(amount) <= 0: return await ctx.reply('The amount to withdraw must be more than `0` coins!', hidden=True)
elif int(amount) > currency["bank"][str(ctx.author.id)]: return await ctx.reply('The amount to withdraw must not be more than what you have in your bank account!', hidden=True)
currency["wallet"][str(ctx.author.id)] += int(amount)
currency["bank"][str(ctx.author.id)] -= int(amount)
await ctx.send(f'You withdrew `{amount}` coin(s) from your bank account.')
Expand Down