Search code examples
node.jscmddiscordbots

"node ." not working when trying to run Discord bot


Here's my code:

const Discord = require('discord.js');

const client = new Discord.Client();

client.once('ready', () => {
    console.log('<Bot Name> is online!');
});




client.login('<Token>');

The bot isn't coming online when I type "node ." into CMD. Any fixes?


Solution

  • What you're missing are intents. Try adding this to you're code, if you use Discord v13.

    
    const Discord = require('discord.js');
    
    const intents = new Discord.Intents(513);
    
    const client = new Discord.Client({ intents });
    
    client.once('ready', () => {
        console.log('<Bot Name> is online!');
    });
    
    
    
    
    client.login('<Token>');