I'm developing a discord bot using discord.py (rewrite branch) for my servers and I need to invite the bot to multiple servers and use it simultaneously.
My question is:
Do I need to set up a new thread for every server or does the bot queue events and handle them one by one? if it does queue them, should I just use that or use separate threads?
Sorry if this is a noobish question but I'm fairly new to discord.py and I don't really understand how it works just yet.
Thanks for reading
No, you just need to define the callbacks (mainly using Client.event
and Bot.command
) that the bot will execute when something happens. All of the logic for listening for events happening on the servers has been taken care of for you. See the examples directory in the discord.py project for some examples.
If your bot is used very widely (hundreds of servers) you will have to start using sharding, which is a process of automatically splitting the traffic between multiple instances of the same bot. You can look at the documentation for the AutoShardedClient
to see how that would work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With