the bot im making has a economy system and u can check ur balance by doing !bal. however i want it such that other users can check your balance and you can check other users balance as well. but right now i only know how to code it that you can check your own balance only. how can i change the code so that you can check other users balance by entering their id or mentioning them?
async def balance(ctx):
await open_account(ctx.author)
user = ctx.author
users = await get_bank_data()
lvsAmt = users[str(user.id)]["leaves"]
tckAmt = users[str(user.id)]["tickets"]
gemAmt = users[str(user.id)]["gems"]
em = discord.Embed(
title=f"{ctx.author.mention}'s Balance",
description=
f"<:zoa_leaves:918778938707279883> {lvsAmt}\n<:zoa_ticket:918774141400801330> {tckAmt}\n<:zoa_gems:918777349946888212> {gemAmt}",
color=0xe9a9a9)
await ctx.send(embed=em)
async def open_account(user):
users = await get_bank_data()
if str(user.id) in users:
return False
else:
users[str(user.id)] = {}
users[str(user.id)]["leaves"] = 0
users[str(user.id)]["tickets"] = 0
users[str(user.id)]["gems"] = 0
with open('mainbank.json', 'w') as f:
json.dump(users, f)
return True
async def get_bank_data():
with open('mainbank.json', 'r') as f:
users = json.load(f)
return users
i tried to change the ctx.author to ctx.user but it doesnt work