Discord Bot doesn't go 'Live'


#1

I recently made a discord bot (https://glitch.com/edit/#!/lava-bot). It’s pretty simple rn. The bot works fine, but it doesn’t go ‘Live’. It just loads forever. I’ve found that this just make it difficult to keep it running. How do i fix this?


#2

You aren’t listening on a port. It will continue to show the loading icon until that’s resolved. Try adding the following toward the top of bot.js

const express = require('express');
const app = express();
app.get("/", (request, response) => {
  response.sendStatus(200);
});
app.listen(process.env.PORT);

#3

I’ve reinstall express, but it gives the error ‘ReferenceError: express is not defined’


#4

Try running ‘enable-pnpm’ from the command line.


#5

Still not working. Same error


#7

Oh, wait - are you referring to the linting error? Just ignore, it doesn’t impact the running of your app. Or change to var app instead of const.


#8

No. It’s stopping the app from running. Here’s the full message:

ReferenceError: Express is not defined

at Object. (/app/bot.js:1:73)

at Module._compile (module.js:652:30)

at Object.Module._extensions..js (module.js:663:10)

at Module.load (module.js:565:32)

at tryModuleLoad (module.js:505:12)

at Function.Module._load (module.js:497:3)

at Function.Module.runMain (module.js:693:10)

at startup (bootstrap_node.js:191:16)

at bootstrap_node.js:612:3

#9

You haven’t required express in your app. var express = require('express')


#10

Works! Thanks a ton!