2017-09-24 5 views
0

私のpollordコマンドを使用しているdiscord.js botに問題がありますが、一定の時間が経過した後の反応の数を確認したいユーザは(yを好む人よりもxを好む人が多い)と言って、尋ねる。Discord.js結果が何らかの作業を必要とするpollコマンド

discord.js:

const Discord = require('discord.js') 

exports.run = async (bot, message, args) => { 
    if (!args) return message.reply("You must have something to vote for!") 
    if (!message.content.includes("?")) return message.reply("Include a ? in your vote!") 
    message.channel.send(`:ballot_box: ${message.author.username} started a vote! React to my next message to vote on it. :ballot_box: `); 
    const pollTopic = await message.channel.send(`${args}`); 
    pollTopic.react(`✅`); 
    pollTopic.react(`⛔`); 
}; 
+0

どのような問題が発生していますか?何がうまくいかなかったのですか?私たちがあなたを助けてくれるよう助けてください:) –

+0

そのxDについては申し訳ありませんが、具体的な回答はありません。基本的に質問しています。「thanはthanよりも反応がもっと多い – ThatMajesticGuy

答えて

0

if (!args) return message.reply("You must have something to vote for!") if (!message.content.includes("?")) return message.reply("Include a ? in your vote!") message.channel.send(`:ballot_box: ${message.author.username} started a vote! React to my next message to vote on it. :ballot_box: `); const pollTopic = await message.channel.send(message.content.slice(2)); await pollTopic.react(`✅`); await pollTopic.react(`⛔`); // Create a reaction collector const filter = (reaction) => reaction.emoji.name === '✅'; const collector = pollTopic.createReactionCollector(filter, { time: 15000 }); collector.on('collect', r => console.log(`Collected ${r.emoji.name}`)); collector.on('end', collected => console.log(`Collected ${collected.size} items`));

私は私自身のボットでこれを試してみましたが、何のことはやったことだった>まず、私が使用される接頭辞はちょうど私がちょうど送られた理由である愛ました私は反応コレクターをDiscord.js documentationの助けを借りて作った。 15秒後、絵文字✅に反応した人の数をconsole.logに記録します。私のコードを見て、あなたの好みに合わせて曲げることができます。あなたが理解できなかった場合、または私がさらに説明することを望む場合、または「私は何か間違ったことをした」場合は、私に返信してください。

関連する問題