SHARE
TWEET

Untitled

xSauron Nov 10th, 2018 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. const agree = "βœ…"
  3. const disagree = "❎"
  4.  
  5. module.exports.run = async (bot, message, args) => {
  6.     const filter = m => m.author === message.author
  7.         message.channel.send("About:")
  8.         message.channel.awaitMessages(filter, {
  9.             max: 1,
  10.             time: 10000
  11.         })
  12.         .then(collected => {
  13.             console.log(collected.first().content)
  14.             reason = collected.first().content
  15.             const filter = m => m.author === message.author
  16.             message.channel.send("Time:")
  17.             message.channel.awaitMessages(filter, {
  18.                 max: 1,
  19.                 time: 10000
  20.             })
  21.             .then(collected => {
  22.                 console.log(collected.first().content)
  23.                 time= collected.first().content
  24.                 const filter = m => m.author === message.author
  25.                 message.channel.send("Type (s / m):")
  26.                 message.channel.awaitMessages(filter, {
  27.                     max: 1,
  28.                     time: 10000
  29.                 })
  30.                 .then(collected => {
  31.                     console.log(collected.first().content)
  32.                     format = collected.first().content
  33.  
  34.                     createvote(bot, message, time, reason, format)
  35.                     }
  36.                 )
  37.                 }
  38.             )
  39.             }
  40.         )
  41.     }
  42.  
  43. async function createvote(bot, message, timea, reason, format){
  44.     let msg = await message.channel.send(`Vote by ${message.author.tag}\n` + "```" + reason + "```")
  45.     await msg.react(agree)
  46.     await msg.react(disagree)
  47.        
  48.     if(format == "sec" || format == "s"){
  49.         timea = timea * 1000
  50.     }
  51.                
  52.     if(format == "min" || format == "m"){
  53.         timea = timea * 1000 * 60
  54.     }
  55.    
  56.     if(format == "hour" || format == "h"){
  57.         timea = timea * 1000 * 60 * 60
  58.     }
  59.     const reactions = msg.awaitReactions(reaction => reaction.emoji.name === agree || reaction.emoji.name === disagree, {time:timea})
  60.  
  61.     if(!reactions.get(agree))
  62.     {
  63.             count = 0
  64.     }
  65.     else{
  66.         count = reactions.get(agree).count-1
  67.     }
  68.     if(!reactions.get(disagree))
  69.     {
  70.         countd = 0
  71.     }else{
  72.         countd = reactions.get(disagree).count-1
  73.     }
  74.                
  75.     message.channel.send(`Voting complete!` + "```"+ reason + "```" +  `\n${agree}: ${count} \n${disagree}: ${countd}`)
  76. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top