[英]How can I make the reaction collector choose the first 2 reactions?
So I try to make reaction collector that pause/play the music after user react to the reaction, But my collector stops when user react 1 time (the user can't react twice, only once), how can i fix it?所以我尝试让反应收集器在用户对反应做出反应后暂停/播放音乐,但是当用户反应 1 次时我的收集器停止(用户不能反应两次,只能反应一次),我该如何解决? this is my code:这是我的代码:
queue.textChannel.send(thing).then((question) => {
question.react('⏸');
question.react('▶️');
question.react('⬅️');
question.react('⏹️');
const filter = (reaction, user) => {
return ['⏹️', '⬅️','⏸','▶️'].includes(reaction.emoji.name) && !user.bot;
};
const collector = question.createReactionCollector(filter, {
max: 1,
time: 0
});
collector.on('end', (collected, reason) => {
if (reason === 'time') {
msg.reply('Times Up');
} else {
const userReaction = collected.array()[0];
const emoji = userReaction._emoji.name;
I fixed it by changing the collector from 'end' to 'collect' and deleted the max: option.我通过将收集器从“结束”更改为“收集”来修复它并删除了 max: 选项。
queue.textChannel.send(thing).then((question) => {
question.react('⏸');
question.react('▶️');
question.react('⬅️');
question.react('⏹️');
const filter = (reaction, user) => {
return ['⏹️', '⬅️','⏸','▶️'].includes(reaction.emoji.name) && !user.bot;
};
const collector = question.createReactionCollector(filter, { time: 400000 });
collector.on('collect', (reaction, reactionCollector) => {
const emoji = reaction.emoji.name;
@ZsoltMeszaros Helped me with the right answer. @ZsoltMeszaros 帮我找到了正确的答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.