VPS and Free Hosting Service for Discord bots
Recommended VPS services¶
If you need to run your bot 24/7 (with no downtime), you should consider using a virtual private server (VPS). Here is a list of VPS services that are sufficient for running Discord bots.
- New York data centre.
- Great affiliate program.
Why not to use free hosting services for bots?¶
While these may seem like nice and free services, it has a lot more caveats than you may think. For example, the drawbacks of using common free hosting services to host a discord bot are discussed below.
The machines are super underpowered, resulting in your bot lagging a lot as it gets bigger.
You need to run a webserver alongside your bot to prevent it from being shut off. This uses extra machine power.
Repl.it uses an ephemeral file system. This means any file you saved through your bot will be overwritten when you next launch.
They use a shared IP for everything running on the service. This one is important - if someone is running a user bot on their service and gets banned, everyone on that IP will be banned. Including you.
Bots are not what the platform is designed for. Heroku is designed to provide web servers (like Django, Flask, etc). This is why they give you a domain name and open a port on their local emulator.
Heroku's environment is heavily containerized, making it significantly underpowered for a standard use case.
Heroku's environment is volatile. In order to handle the insane amount of users trying to use it for their own applications, Heroku will dispose your environment every time your application dies unless you pay.
Heroku has minimal system dependency control. If any of your Python requirements need C bindings (such as PyNaCl binding to libsodium, or lxml binding to libxml), they are unlikely to function properly, if at all, in a native environment. As such, you often need to resort to adding third-party buildpacks to facilitate otherwise normal CPython extension functionality. (This is the reason why voice doesn't work natively on heroku)
Heroku only offers a limited amount of time on their free programme for your applications. If you exceed this limit, which you probably will, they'll shut down your application until your free credit resets.