Hey everyone! I’m trying to figure out how to keep my Python Discord Bot running non-stop on repl.it. I used to use the keep_alive method but it’s not working anymore for some reason. Has anyone found a reliable way to do this?
I’m getting an error message in the console that looks like this:
172.18.0.1 - - [16/Feb/2019 11:25:10] "GET / HTTP/1.1" 200 -
I’m not sure what this means or how to fix it. Any ideas on how to keep my bot online 24/7 on repl.it? I’d really appreciate some help or suggestions from those who’ve managed to do this successfully. Thanks in advance!
I’ve been running my Discord bot on repl.it for a while now, and I’ve found a few tricks that work well. First off, that error message you’re seeing is just a standard log, nothing to worry about. The real issue is keeping your bot awake.
What’s worked for me is setting up a simple web server using Flask within your bot’s code. Then, use a service like UptimeRobot to ping this server every few minutes. This prevents your repl from going to sleep.
Another tip is to use a worker thread for any long-running tasks, which can help avoid timeouts and unresponsiveness. Ensuring that all your libraries, especially discord.py, are up to date is also crucial. Finally, always use environment variables or a secrets manager for your bot token and other sensitive information.
Hope this helps!
hey there! i’ve had similar issues. have u tried using uptimerobot to ping ur repl every few mins? that worked for me. also, check if ur using the latest version of discord.py. sometimes outdated libs cause weird errors. good luck with ur bot!
I’ve encountered this issue before. The error you’re seeing is actually normal - it’s just a log of HTTP requests to your repl. The real problem is likely that repl.it puts projects to sleep after inactivity. To combat this, you can set up a simple Flask server in your code and use a service like UptimeRobot to ping it regularly. This keeps your repl awake. Additionally, make sure you’re using environment variables for your bot token and other sensitive info. Repl.it has a built-in secrets manager for this purpose. Lastly, consider using a worker in your code to handle long-running tasks separately from your main bot logic. This can improve stability and prevent timeouts.