I have a trouble about my discord bot

Hey @33333-33333,

This should solve the problem, at least it did for me!

  1. Add a new package in package.json called Express.
    So your package.json should look like this:
{
  "name": "glitch-discord-bot",
  "version": "0.0.0",
  "description": "discord bot sample on Glitch",
  "main": "main.js",
  "dependencies": {
    "discord.js": "^11.5.1",
    "express": "^4.16.4"
  },
  "devDependencies": {},
  "scripts": {
    "start": "node main.js",
    "test": "node main.js"
  }
}
  1. Then at the top of main.js, add these few lines:
const http = require("http");
const express = require("express");
const app = express();

app.use(express.static("public"));

app.get("/", (request, response) => {
  console.log(Date.now() + " ping received!");
  response.sendStatus(200);
});

app.listen(process.env.PORT);
setInterval(() => {
  http.get("http://drednot-bot.glitch.me/");
}, 280000);

Thanks to @J-Tech-Foundation and @Verico

fa023dc3-435f-4c6c-a7ba-1afa8ff24f66_thumbnails_shaking_box%20(19)
hmmmm… what happened to my bot…

Try deleting the bot and creating a new one. It usually happens after when the Uptime Monitor is not working. Or do you see any errors in the logs?


are they errors?

anyway, uptimerobot says that the bot is not down. If i have to make a new bot, could i copy and paste assets? I uploaded a number of pictures to there.

I didn’t mean to delete the Glitch project and create a new one! In Discord, delete the bot you have and create a new one.

it did not change anything :(((

I must admit, this is a very frustrating problem!

Are you sure you entered a token in the .env file?


yes

By any chance, do you have the following error in your logs?

(node:544) UnhandledPromiseRejectionWarning: Error: Something took too long to do.
    at timeout.client.setTimeout (/rbd/pnpm-volume/0be04d99-7540-41f3-96f0-0d16fc82a413/node_modules/.registry.npmjs.org/discord.js/11.5.1/erlpack@0.1.0/node_modules/discord.js/src/client/ClientManager.js:40:57)
    at Timeout.setTimeout [as _onTimeout] (/rbd/pnpm-volume/0be04d99-7540-41f3-96f0-0d16fc82a413/node_modules/.registry.npmjs.org/discord.js/11.5.1/erlpack@0.1.0/node_modules/discord.js/src/client/Client.js:436:7)
    at ontimeout (timers.js:436:11)
    at tryOnTimeout (timers.js:300:5)
    at listOnTimeout (timers.js:263:5)
    at Timer.processTimers (timers.js:223:10)
(node:544) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 11)
(node:544) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Could you remove SECRET = and MADE_WITH= in the .env file?


errors were found.
i deleted “secret” and “made with”.

Hey @33333-33333,

Maybe you could invite me to your project through a DM?

Your project name is drednot-bot, am I right?

yeah. i have already invited u. did you find any wrong points?

Errr…from where did you copy the token? Your token looks very suspicious. It might be the Client Secret you have copied? Because usually, Discord tokens are very long!

yeah i used client secret…

This is how you copy the Discord token.

  1. On the left sidebar of the Discord Developer page of your bot, select Bot.
  2. Under the heading of Token, you will see a button that says Copy. Click on it.
  3. Paste it in the .env

true. i did so. is it correct way to copy the token?
then, why did you say that “Your token looks very suspicious.”?
(i reached the limit of post)

solved :))))
thank you so muchhhhhhh XD

1 Like

Yes. In fact, this is what’s called the Discord token.