Ask coding questions

← Back to all posts
Hosting a Discord bot on Repl
Kiansjet (3)

Hello!

Real quick, I have a stupidly simple NodeJS Discord.js Discord bot I wrote. Am I able to just run it on Repl? I remember seeing a banner saying I could host sites on Repl. Is there a rule against this? Is there an amount of time a Repl VM will run before terminating?

Answered by Zavexeon (1167) [earned 5 cycles]
View Answer
Comments
hotnewtop
Zavexeon (1167)

Yes, you can using uptimerobot, like @Vandesm14 and @ash15khng said. I'll give you step by step instructions. Please note that your repl will need a front end (an HTML page).

  1. ) Create an account at https://uptimerobot.com/
  2. ) Login and go to your dashboard on uptimerobot
  3. ) Click "Add New Monitor"
  4. ) In the menu that pops up, set monitor type as "HTTP(S)", give it a friendly name (can be anything you want), and set the URL as the link to the front end (the repl.co one).
  5. ) Set the monitoring time to 30 minutes or less.
  6. ) Click "Create Monitor" at the end of the form.
tradlimb (4)

@Zavexeon How do I create the front end?

Zavexeon (1167)

@DomLowe An easy way to create a front end is

require('http').createServer((req, res) => res.end('Bot is alive!')).listen(3000)
Vandesm14 (2752)

You are allowed to host a Discord bot on repl.it
If you use Uptime Robot and setup a ping/http monitor to ping your repl, you can keep it alive forever!

Please mark this as answered if I helped your problem 👍

ash15khng (723)

It will terminate after a while, but you can use something called Uptime Robot to keep your repl up! (not sure how to use it tho only heard of people using it)

decomp (3)

bots go offline at night for me and never are up 24/7

RiccardoGiorgi (0)

@decomp at night: what time more or less?