Help getting a Discord bot running without console

Please consider providing your Glitch project’s name in your post. Many problems are very difficult to troubleshoot without being able to see the code involved. Users who haven’t been invited to your project won’t be able to edit your code or see the secrets in your .env file just from your project name.

Hello guys, I’m new here so sorry if this is a dumb question. I’m trying to make a Discord bot but I’m having trouble getting it up and running. I wrote the code on my computer first, and then pushed it to GitHub, and then imported it here. If I open us the terminal and type node goalbot.js it runs and I can use the bot in Discord. But if I close the console it stops and clicking ‘Show’ it always gets stuck on ‘Starting…’. What am I doing wrong?

Any help appreciated, thanks.

Project name: goalbot My Bot

Your bot will not show anything because you did not set up a webpage for your bot. Having a page for your bot is not needed (your bot will run without it), but if you would like to add one I recommend looking into ExpressJS.

Hello, thanks for your reply. Do I need a webpage for the bot to work with Discord? Even if it doesn’t display anything, it should still pick up on my discord commands, right?

As long as your bot is being pinged at least every five minutes, it should work without a webpage.

Okay. I have in my package.json this code.

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node goalbot.js"
  },

Will this start the bot?

Yes, assuming that your main file is goalbot.js.

1 Like