Is it possible to run the same bot multiple times and have them each independently handle commands?
I was wondering if I can just run multiple instances of the same bot and have them handle commands on a per channel basis. Each instance of the bot would have it's own config that tells it what channel it can respond to commands in.
I was able to achieve this in discord-akairo (old discord framework) with message commands, but I don't know if this would work with interaction commands.
Solution:Jump to solution
Nevermind. Everything worked perfectly from the start. My own filter feature was making me think no messages were being sent to the second instance's channel. I guess there was an influx of messages all at once in the first instance's channel which made me think it was both instance's messages.
19 Replies
Basically, I have a minecraft chat bot that I can interact with through discord.
One instance of my program hooks up to one discord bot and one minecraft account through a config. The config tells it what channel corresponds to what minecraft account.
I want to run multiple minecraft accounts, so I'm attempting to run multiple instances of my program, but with separate configs for each.
you weren't really able to handle this with akairo because both bots still received all events, you or something akairo did was just filtering out certain events with a dead simple if check:
Yes that is what I was implying
I checked the channel ID
And checked the ID against the config the bot was running against
it's a basic if check. If you're asking if you can write a basic if check in Sapphire then ya duh ofc you can.. it's a basic if check
I've attempted to do that
But I notice that sapphire is now sending all messages through one channel of the first instance
Even though it doesn't even know about the other configs channel IDs. It shouldn't be sending messages there.
So I'm wondering if this is something to do with interactions.
shouldn't be, idk, but you can solve all your problems by just making a separate bot application with a separate token. That's the proper way to do it anyway.
I didn't want to create 15 tokens
Haha
You said 2, not 15.
Sorry, I meant for it to be able to run multiple instances in general
AKA not just one
And maybe just stick to message commands then no idea what you're really trying to achieve. Sounds like you're overcomplicating things very very much
I'm trying not to write more complicated code to manage multiple minecraft bots over multiple channels on a single instance
anyway my guess is that you're not if checking / returning properly
But to just run multiple instances of code designed to run a single minecraft bot / a single discord bot
can't really say much more without source code tbh
Sure let me finish up some commits
Ill look tomorrow. I'm going to bed now. Gnight
Good night.
Solution
Nevermind. Everything worked perfectly from the start. My own filter feature was making me think no messages were being sent to the second instance's channel. I guess there was an influx of messages all at once in the first instance's channel which made me think it was both instance's messages.
(How many times did I use the word
instances
?)