【问题标题】:making a discord bot followed a tutorial and it dint work按照教程制作不和谐机器人,但它没有用
【发布时间】:2021-01-16 15:43:23
【问题描述】:

我正在使用 node.js 和 Visual Studio

机器人似乎不工作,但确实响应了节点。命令,但不响应 -ping 命令,我可以找出原因,是拼写还是更新了代码,或者我只是愚蠢,请帮忙。


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

const client = new Discord.Client();

const prefix = '-';

client.once('ready', () => {
    console.log('sirjunkbot is awake');
});

client.on('message', message =>{
    if(!message.content.startsWith(prefix) || message.author.bot) return;

    const args = message.content.slice(prefix.length).split(/ +/);
    const command = args.shift().toLowerCase();

    if(command === 'ping'){
        message.channel.send('pong!');
    } else if (command == 'test'){
        message.channel.send('123');
    }
});

【问题讨论】:

    标签: node.js visual-studio-code discord


    【解决方案1】:

    控制台说什么? 你也没有client.login()

    【讨论】:

    • 我修复它但我应该有客户端登录
    猜你喜欢
    • 2021-08-19
    • 2021-09-11
    • 2019-04-13
    • 2021-04-26
    • 2021-11-18
    • 2022-10-24
    • 2023-04-04
    • 2021-01-17
    • 1970-01-01
    相关资源
    最近更新 更多