Hello,
I have made a discord bot and when I close out vsc after 5 min the bot will go offline how do i fix that
Welcome to the forums, @pred12! Projects go to sleep after 5 minutes if they aren’t interacted with. Other bot projects have had success using Uptime Robot to automatically send requests to keep their bot awake.
Thanks but i dont know how to setup Uptime Robot:(
This example project’s README goes into some detail about how to get Uptime Robot or another auto-ping service working with an app: https://glitch.com/edit/#!/twitterbot-autorespond?path=README.md:1:0
oh that is for twiter thought? (sorry to bother you)
i need it for discord thoght
For the URL, you’ll need to provide the url of your project. So if your project is ‘cool-bot’ you’d say ‘https://cool-bot.glitch.me/’, and then make sure that if you go to that URL it provides a page without an error.
ok so do u need to make a website?
You’ll need to add code to your bot script that can serve a simple web page. You can use code like the example here, though you don’t need the setInterval trick they’re using.
Thanks do I still need to use uptime robot if so idk how to put a webste into a .js file
Yes, you still need to use a third-party service like Uptime Robot. You don’t need to put a website into a .js file. You can use the code in the link provided by my colleague above.
Ok thanks sorry i am new to this stuff
I actually just made my Discord.js bot on Glitch, and it seems to be always online. No external hosting, or anything.
it’s just being hosted via Glitch.
I assume that the Discord API is just making the project always run.
For you it could be something like a token error (misspelled token).
@zira Discord API does not keep your bot online, also, You should not use modded discord versions (BandagedBD) as it will get you completely banned! I’m sure there is something keeping your bot up somehow on glitch itself, or maybe you setup an external uptime bot and forgot.
@pred12 I suggest using this instead of Uptime Robot, as Uptime robot has not been doing well with Glitch Projects lately from what I have been seeing!
I have had no issues with Uptime Robot. I have 5 glitch jobs that are close to 100% the last 30 days.