Ask coding questions

← Back to all posts
How can I make a discord bot stay online even after I close the page?
hillsam001 (26)

I have a discord bot here that I made just as a placeholder for my discord server. Everything works fine, but when I close the tab it goes offline! How can I make it stay online?

Answered by a5rocks (834) [earned 5 cycles]
View Answer
a5rocks (834)

Follow the steps here to keep it alive.

EDIT: Please make sure your token is secure. Regenerate it, and then use a .env file to keep it secure. If people get your token, they can, for example, delete all the channels in every server it has access to. (if you don't want to secure your bot, just make sure it doesn't have the permissions to do anything disastrous)

hillsam001 (26)

@a5rocks Okay, thanks for the tip.


@a5rocks thank you so much! Ur a life saver!

tdhthekid (0)

mate your token is public

hillsam001 (26)

@tdhthekid it's fine, i don't use the bot anymore as it was just for testing

Cerberus_75 (17)

going off what @a5rocks said after you set up your flask server you can use uptime robot to constantly ping your bot and keep it "alive" for much longer (there are downtimes, but its a start). You can use this tutorial made by @badvillain01: Good Luck!