首页 > 解决方案 > 如何制作提前投票命令 Discord.js

问题描述

嘿,所以我正在制作一个民意调查命令概念,但我不知道如何让它成为我的概念

author : >poll
bot : (embed that says you must pick the option 1)
author : say the option 1
bot : (embed that says you must pick the option 2)
author : say the option 2
bot: ( message that says we must react to reaction number 1 or number 2 ) 

有人知道我的概念吗?

我的当前代码

}else if (command =="poll"){
    const pollbase = new D.MessageEmbed()
    .setDescription('What Is Your First Option')
    .setAuthor('The Bot')
    .setTimestamp()
    .setFooter('The Bot')
    .setColor(color)
   msg.channel,send(pollbase)
}

我不知道下一步该怎么做有人可以帮助我吗?

标签: javascriptnode.jsdiscorddiscord.js

解决方案


您可以使用TextChannel.awaitMessages()

const pollbase = new D.MessageEmbed()
  .setDescription("What Is Your First Option")
  .setAuthor("The Bot")
  .setTimestamp()
  .setFooter("The Bot")
  .setColor(color);
msg.channel.send(pollbase);

// create message filter
const filter = (m) => m.author.id === msg.author.id;

msg.channel.awaitMessages(filter, { max: 1 }).then((collected) => {
  // do whatever you want with the next message sent
  console.log(
    `${message.author.username} responded: ${collected.first().content}`
  );
});

推荐阅读