Discord.js等待回复

时间:2020-02-08 11:50:58

标签: javascript discord discord.js

我希望我的机器人将一些消息发送到某个频道,然后将消息发送给用户,然后等待用户回复完毕,然后将消息发送给特定消息。

case 'train':
  if (message.member.roles.has('649756129240547348')) {
    const user60 = message.author.username;
    bot.channels.get("649756880314302464").send('<@&673125623463673857>');
    bot.channels.get("649756880314302464").send('Subway Security Trainings!! \n Are you still awaiting tryout? Then come along to this training.\n (Slock in 10-15 minutes)\n https://www.roblox.com/games/4582202027/Subway-Security-Tryout-Centre\n https://discord.gg/bvYgmDe');
    bot.channels.get("649756880314302464").send('Training underway, hosted by ' + user60);
    message.author.send('Tell me when you have finished(say Finished)');
    const collector = new Discord.MessageCollector(message.channel, m => m.author.id === message.author.id, {
      time: 100000
    });
    collector.on('collect', message => {
      if (message.content == 'Finished') {
        bot.channels.get("649756880314302464").send('Training has finished. Hosted by ' + user60);
        message.channel.sendMessage('Thanks!')
      } else if (message.content == 'finished') {
        bot.channels.get("649756880314302464").send('Training has finished. Hosted by ' + user60);
        message.channel.sendMessage('Thanks!')
      }
    })
  } else {
    message.channel.sendMessage('You do not have the permission to do this command')
  }
  break;

0 个答案:

没有答案