【问题标题】:"node ." not working when trying to run Discord bot“节点。”尝试运行 Discord 机器人时无法正常工作
【发布时间】:2021-12-31 12:41:46
【问题描述】:

这是我的代码:

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

const client = new Discord.Client();

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




client.login('<Token>');

当我输入“node”时,机器人没有上线。进入CMD。有什么修复吗?

【问题讨论】:

    标签: node.js cmd discord bots


    【解决方案1】:

    您缺少的是意图。如果您使用 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>');
    

    【讨论】:

    • 非常感谢!
    猜你喜欢
    • 2017-10-11
    • 2020-10-29
    • 1970-01-01
    • 2018-03-27
    • 2022-11-26
    • 2017-11-08
    • 2021-12-20
    • 2020-08-16
    • 1970-01-01
    相关资源
    最近更新 更多