a error
#7230
Replies: 4 comments
-
this error is not related to the discord.py library |
Beta Was this translation helpful? Give feedback.
0 replies
-
which command was used and how was it used ? |
Beta Was this translation helpful? Give feedback.
0 replies
-
bruh, json != db, and error says: there is no such key in dict |
Beta Was this translation helpful? Give feedback.
0 replies
-
This error is not related to discord.py |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Ignoring exception in command balance:
Traceback (most recent call last):
File "E:\pyytthhoonn\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "e:\pyth\main.py", line 18, in balance
await open_account(ctx.author)
File "e:\pyth\main.py", line 38, in open_account
users[str(user.id)]["wallet"] = 0
KeyError: '857858921905127484'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "E:\pyytthhoonn\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "E:\pyytthhoonn\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "E:\pyytthhoonn\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: '857858921905127484'
this was my error ||
and my code i use json to store data
import discord
from discord.ext import commands
import json
import os
from discord.utils import get
os.chdir("E:\pyth")
client = commands.Bot(command_prefix="e!")
@client.event
async def on_ready():
print("i am online")
@client.command()
async def balance(ctx):
"""getting our balance"""
await open_account(ctx.author)
users = await get_bank_data()
async def open_account(user):
"""makes a new account"""
users = await get_bank_data()
if str(user.id) in users:
return False
else:
users[str(user.id)]["wallet"] = 0
users[str(user.id)]["bank"] = 0
async def get_bank_data():
""""gets values"""
with open("mainbank.json","r") as f:
users = json.load(f)
client.run("")
pls help with error
Beta Was this translation helpful? Give feedback.
All reactions