Skip to content

Commit 8d09c23

Browse files
authored
Merge pull request #80 from PyBotDevs/dev-command-modify-balance
Add dev command `/modify_balance`
2 parents 596d80e + 76b6d70 commit 8d09c23

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

main.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,23 @@ async def donate(ctx:SlashContext, id:str, amount):
10531053
localembed2.add_field(name="Your ID", value=id, inline=True)
10541054
await ctx.send(embed=localembed)
10551055
await reciever_info.send(embed=localembed2)
1056+
1057+
@slash.slash(
1058+
name='modify_balance',
1059+
description="Modifies user balance (Normal Digit: Adds Balance; Negative Digit: Removes Balance)",
1060+
options=[
1061+
create_option(name='user', description="Specify the user to change their balance", option_type=6, required=True),
1062+
create_option(name='modifier', description="Specify the balance to modifiy", option_type=4, required=True)
1063+
]
1064+
)
1065+
async def modify_balance(ctx:SlashContext, user:discord.User, modifier:int):
1066+
if ctx.author.id != 738290097170153472: return ctx.send("Sorry, but this command is only for my developer's use.", hidden=True)
1067+
try:
1068+
currency["wallet"][str(user.id)] += modifier
1069+
save()
1070+
await ctx.send(f"{user.name}\'s balance has been modified by {modifier} coins.\n\n**New Balance:** {currency['wallet'][str(user.id)]} coins", hidden=True)
1071+
except KeyError:
1072+
await ctx.reply("That user doesn't exist in the database.", hidden=True)
10561073

10571074
# Initialization
10581075
utils.ping.host()

0 commit comments

Comments
 (0)