简体   繁体   English

如何制作提前投票命令 Discord.js

[英]How To Make An Advance Poll Command Discord.js

Hey So Im making an poll command concept but i cant figure out how make it My Concept嘿所以我在做一个投票命令的概念,但我不知道如何让它成为我的概念

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 ) 

Do anyone know my concept ?有人知道我的概念吗?

My Curret Code我的当前代码

}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)
}

i have no clue what to do next can someone help me ?我不知道接下来要做什么有人可以帮助我吗?

You can use TextChannel.awaitMessages() :您可以使用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}`
  );
});

your msg.channel,send(pollbase) part needs to be msg.channel.send(pollbase) .你的msg.channel,send(pollbase)部分需要是msg.channel.send(pollbase) you put a comma before 'send' instead of a period你在“发送”前加一个逗号而不是句号

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM