javascript - 如何制作提前投票命令 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)
}
我不知道下一步该怎么做有人可以帮助我吗?
解决方案
您可以使用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}`
);
});
推荐阅读
- php - 创建新页面而不创建新文件
- android - 存储单个字符串的内容提供程序
- .net-core - 是否可以使用一个共享框架发布多个自包含的 .Net Core 应用程序
- indexing - Solr 索引文档很晚
- angular - 添加查询参数时Angular 5路由器不匹配
- c++ - 当我在 libtorrent 上调用 dht_get_item 时,警报说该项目未初始化
- java - 使用 Criteria API 根据条件计算加入表的结果
- php - 通过php登录instagram
- mongoose - 在 Post Hooks 中修改 Mongoose 对象
- c - 用逗号分隔的十六进制值将文件读入C中的数组