Timeout when Login discord bot by using discord.js

Viewed 43

I've created a discord bot, and it cannot even login.

const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
const { token } = require("./config.json");

client.once('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
});

client.login(token);

That's my code, I wrote it follows the official API. And the problems occurs below.

node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^

ConnectTimeoutError: Connect Timeout Error
    at onConnectTimeout (D:\midtest\node_modules\undici\lib\core\connect.js:131:
24)
    at D:\midtest\node_modules\undici\lib\core\connect.js:78:46
    at Immediate._onImmediate (D:\midtest\node_modules\undici\lib\core\connect.j
s:117:33)
    at processImmediate (node:internal/timers:466:21) {
  code: 'UND_ERR_CONNECT_TIMEOUT'
}

I can't even login succeed once. Please help.

0 Answers
Related