Discord bot does not connect with no error messages

My Discord bot (~acolyte-bot) won’t login to the discord API. I’m using Discord.js. I have tried:

  • curl -I https://discordapp.com/api/v7/gateway
    • returns HTTP/1.1 200 OK
  • enable-pnpm
    • reinstalls, but same problem
  • reducing my code down to minimal required code.
    • The console only prints Express app started on port 3000 on every restart.
    • The token seems to be valid because it doesn’t error with An invalid token was provided.
See code
const express = require('express');
const app = express();

const { Client } = require('discord.js');
const botClient = new Client();

  .on('ready', () => console.log(botClient.user.username + ' connected!'))
  .on('disconnect', () => console.log(botClient.user.username + ' disconnected!'))
  .on('error', err => console.error(err))
  .then(() => console.log('Bot logged in!'));

app.listen(3000, () => console.log('Express app started on port 3000'));

Any ideas?

Edit: this started occurring around 0:00 eastern.

I use this.

// Require discord.js package
const Discord = require("discord.js");

// Display a message when the bot comes online
client.on("ready", () => {
  console.log(`Logged in as ${client.user.tag}!`);

// Log in the bot using your token (password)

New development:

I tried your code @Xenfo, on both Glitch and on my local PC.
On Glitch:

  • No logging
  • Perpetual spinner:

On my PC:

  • No logging
  • No spinner, but nothing happens:

It probably isn’t a Glitch issue, but a Discord one.

I tried regenerating the bot token, but same result.

Haiya! There’s currently a few issues with discord.js and the glitch servers right now. Where you have the client.login, can you log errors?


And tell me what is logged in the console.

For the ‘perpetual spinner’, you need to append this code to your server.js:

const listener = app.listen(process.env.PORT, function() {
  console.log("Your app is listening on port " + listener.address().port);

Apparently this is due to too many IDENTIFY requests from the bot (limited to 1000 / 24h), and it won’t throw any errors; instead it just waits until it is allowed to make a new request to login. You can see the status of the bot by adding a listener to the debug event from the client: it will show when the bot is waiting to make a new request.

client.on('debug', console.log);

The only way to fix this is to wait until the 24 hours are over. Avoid this by adding a throttle to watch.json.

  "install": {
    // ...
  "restart": {
    // ...
  "throttle": 900000 // delay in milliseconds (900000 = 15 min)
1 Like