Discord.js bot在等待消息时回复自己

时间:2018-03-01 19:47:27

标签: javascript node.js discord.js

在机器人发送消息 message.channel.send('Fortnite added!'); 或其他角色后,机器人会使用默认消息回复自己,直到5秒用完为止。< / p>

const awaiting = await message.channel.send('Awaiting your role(s)...');

const roles = await message.channel.awaitMessages(msg => {
    console.log(msg.content);

    switch(msg.content) {
        case 'fortnite':
            message.member.addRole('ROLEID');
            message.channel.send('**Fortnite** added!')
            break;
        case 'pubg':
            message.member.addRole('ROLEID');
            message.channel.send('**PUBG** added!')
            break;
        case 'hots':
            message.member.addRole('ROLEID');
            message.channel.send('**HOTS** added!')
            break;
        default:
            message.channel.send('This is not a valid role!');
            return;
    };

}, {time: 5000});

message.channel.send('Await completed!')

我将命令存储在其他文件中的节点

到目前为止我尝试了什么:

if (message.author.bot) return;

在我的bot.js和此代码来自的js文件中:

switch(msg.content.toLowerCase()) {}

尝试使其仅以小写形式工作。

0 个答案:

没有答案
相关问题