#KeyError of command on different instance of Bot

1 messages · Page 1 of 1 (latest)

warm quarry
#

When running my program on my discord bot which has an entirely separate program running on the same bot with its own slash commands I am getting a KeyError when commands from the other instance are called. Is there any way to prevent this?

quaint totemBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

plucky jetty
warm quarry
plucky jetty
warm quarry
#

different codebases

#

discord api is designed to allow this as are most libs?

plucky jetty
warm quarry
#

yeah two different languages

plucky jetty
#

try on command error

#

search the docs i am using my phone at 1am

tall rampart
#

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

warm quarry
tall rampart
#

It just expects that your bot is able to process any of the commands it has registered to discord

warm quarry
tall rampart
#

Running multiple clients for one bot account is not a common use case, so it likely wasn't thought about much during development

lofty patrol
#

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.py defines /foo
  • Client.js defines /bar
    assuming no command overwrites by either client. when a user calls /bar, .js AND .py will receive the interaction event corresponding to /bar. .js responds as expected, but .py can't find the definition for /bar, causing it to error out