简体   繁体   中英

My discord bot does not connect whenever I run 'node index.js'

It was working earlier (a few minutes before it stopped working) and now it just sits there with an open end attempting a connection. My console should print out "Ready" upon a successful start. However, it does not print anything out.

What I tried:

  • Reverting to an older commit that I know was functional.

  • Removing the proxy (I had to use a proxy because this bot is connecting to an API that is white list only and I did not want to send my personal IP).

  • Restarting my computer. Restarting CMD. Restarting VSCode.

Nothing worked.

Here is the basic structure.

bot.on('ready', () => {
    console.log('Ready')
})


bot.login(token)

This is my console:

Command Prompt

EDIT: It works now, but it wasn't working earlier. Everything else on my computer was working (Chrome, Discord voice chat, VPN) except for the bot.

It may have run into an error. If you're not already handling errors, try listening for other events asoutlined here :

bot.on('error', (e) => console.error(e));
bot.on('warning', (e) => console.warn(e));
bot.on('debug', (e) => console.info(e));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM