📜  discord.js 等待消息 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:44.595000             🧑  作者: Mango

代码示例2
message.channel.awaitMessages(m => m.author.id == message.author.id,
    { max: 1, time: 30000 }).then(collected => {
        if (collected.first().content.toLowerCase() == 'yes') {
            message.reply('Shutting down...');
            client.destroy();
        }
        else
            message.reply('Operation canceled.');
    }).catch(() => {
        message.reply('No answer after 30 seconds, operation canceled.');
    });