Skip to content
← Back to Community
How can I make a discord bot stay online even after I close the page?
Profile icon
hillsam001

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 [earned 5 cycles]
View Answer
Voters
Profile icon
abbesyoussef929
Profile icon
luakgames
Profile icon
OPGAMER
Profile icon
Endy3032
Profile icon
ProfessorDragon
Profile icon
hillsam001
Comments
hotnewtop
Profile icon
a5rocks

https://www.codementor.io/garethdwyer/building-a-discord-bot-with-python-and-repl-it-miblcwejz#keeping-our-bot-alive

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)

Profile icon
hillsam001

@a5rocks Okay, thanks for the tip.

Profile icon
[deleted]

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

Profile icon
NielsPenninga1

lol

Profile icon
tdhthekid

mate your token is public

Profile icon
hillsam001

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

Profile icon
Cerberus_75

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: https://repl.it/talk/learn/How-to-use-and-setup-UptimeRobot/9003. Good Luck!