#KeyError of command on different instance of Bot
1 messages · Page 1 of 1 (latest)
Hey! Once your issue is solved, press the button below to close this thread!
i dun think so why would you do this?
Why would I do what?
run the bot in 2 seperatte instance
like i assume one part is written in js or some other language while one is python?
yeah two different languages
Discord sends events to every connected bot, and since i.py is getting commands it doesn't recognize, it causes that error
The two ways I can see to deal with this is to use one of the error events to suppress the error, or create "empty" commands that do nothing
I am surprised that the library raises an error since it knows which commands are and are not there
It just expects that your bot is able to process any of the commands it has registered to discord
Why tho? It knows what commands is should handle so why should it want to process any others?
Running multiple clients for one bot account is not a common use case, so it likely wasn't thought about much during development
my guess is the client instance expects all commands to be defined, so if you define it in a different instance but not in the original, the original instance would also receive the interaction event. but fails to call it, hence the error
suppose
Client.pydefines/fooClient.jsdefines/bar
assuming no command overwrites by either client. when a user calls/bar,.jsAND.pywill receive the interaction event corresponding to/bar..jsresponds as expected, but.pycan't find the definition for/bar, causing it to error out