添加反应以嵌入订单

时间:2018-08-01 13:52:55

标签: javascript bots discord discord.js

我得到了以下代码行:

if (command === 'upcoming') {
  if (message.member.roles.find('name', 'Lúcifer')) {
    const change = args.join(' ');
    message.delete().catch(O_o => {});
    const upcomingEmbed = new Discord.RichEmbed()
      .setColor('#FFAA44')
      .setAuthor('Trench: Changelog and upcoming', `${client.user.avatarURL}`)
      .addField('Upcoming:',
        `${change}`)
      .setFooter('Powered by FullGaamer')
      .setTimestamp();

    message.channel.send(upcomingEmbed).then(embedMessage => {
      embedMessage.react('');
      embedMessage.react('');
    });
  } else {
    message.channel.send('Você não tem permissão para utilizar deste comando.');
  }
}

&反应会随机显示,但我希望它们始终按此顺序显示!

我尝试在await之前使用embedMessage,但没有成功!

1 个答案:

答案 0 :(得分:1)

使用异步并等待。

message.channel.send(upcomingEmbed).then(async embedMessage => {
    await embedMessage.react('');
    await embedMessage.react('');
});