await open_account(ctx.author) users = await get_bank_data() earnings = (a_var3) users[str(discord.user.id)]["Simp Wallet"] += [email protected]()async def balance(ctx): await open_account(ctx.author) users = await get_bank_data() wallet_amt = users[str(user.id)]["Simp Wallet"] = 0 bank_amt = users[str(user.id)]["Simp Bank"] = 0 em = discord.Embed(title = f"{ctx.author.name}'s Balance") em.add_field(name = "Simp Wallet", value = wallet_amt) em.add_field(name = "Simp Bank", value = bank_amt) await ctx.send(embed = em)async def open_account(user): users = await get_bank_data() if str(user.id) is users: return False else: users[str(user.id)]["Simp Wallet"] = 0 users[str(user.id)]["Simp Bank"] = 0 with open('mainbank.json',"w") as f: json.dump(users,f) return Trueasync def get_bank_data(): with open('mainbank.json',"r") as f: users = json.load(f) return usersDiscord.ext.commands.errors.CommandInvokeError:命令引發異常:KeyError:'594750729810477063'。就是這么說的。我不是這方面的專家,所以,任何幫助將不勝感激!完整回溯如下:The above exception was the direct cause of the following exception:Traceback (most recent call last): File "C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\bot.py", line 903, in invoke await ctx.command.invoke(ctx) File "C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 859, in invoke await injected(*ctx.args, **ctx.kwargs) File "C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped raise CommandInvokeError(exc) from excdiscord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: '345878244756684801'
KeyError:discord.py 中的“594750729810477063”
幕布斯6054654
2023-10-06 13:45:20