Hey everyone! I’m working on a discord bot project and I’ve got a question. Is there a way to run multiple bot accounts from one discord.py script? I’ve seen some premium bots do this, like Dyno. What I’m thinking is having a list of bot tokens in the script instead of just one. Does anyone know if this is doable?
I’m not sure if I should try to make some kind of API for this or if there’s an easier way. If you’ve done something like this before, I’d love to hear how you did it! Any tips or advice would be super helpful. Thanks a bunch for your time!
I’ve actually tackled this challenge before in a project. It’s definitely doable, but there are some quirks to be aware of.
The main approach is to use asyncio to run multiple bot instances concurrently. You’ll need to create separate client objects for each bot token and then use asyncio.gather() to run them all together.
One gotcha I encountered was handling global state across bots. If you’re not careful, you can end up with shared data that causes unexpected behavior. I ended up using separate database connections for each bot to keep things isolated.
Performance can also be an issue if you’re running many bots on one machine. I had to do some optimization work, like using connection pooling and caching, to keep things running smoothly.
Overall, it’s a fun challenge that really pushes your asyncio skills. Just be prepared for some debugging adventures along the way!
yep, it’s possible. i’ve done it before. you’ll need asyncio to run multiple bot instances at once. create a client object for each token and use asyncio.gather() to run em together. watch out for rate limits tho, discord can get angry if u spam too much. good luck with ur project!
Yes, it’s definitely possible to manage multiple bot accounts from a single discord.py script. I’ve done this before for a project where we needed separate bots for different server tiers.
The key is to create multiple bot instances, each with its own token. You can store the tokens in a list or dictionary, then iterate through them to create and run each bot. You’ll need to use asyncio to run the bots concurrently.
One thing to keep in mind is that each bot will need its own event handlers and command sets. This can get complex quickly, so I’d recommend modularizing your code and possibly using cogs to keep things organized.
Just be careful not to hit Discord’s rate limits, especially if you’re running many bots. Good luck with your project!