daily pastebin goal
37%
SHARE
TWEET

Untitled

a guest Sep 14th, 2018 81 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. Error: (in discord no error shown in console)
  2. TypeError: message.awaitReactions is not a function
  3.  
  4. const commando = require('discord.js-commando');
  5.  
  6. class duelResultsCommand extends commando.Command
  7. {
  8.     constructor(client)
  9.     {
  10.         super(client, {
  11.             name: 'duelresults',
  12.             group: 'simple',
  13.             memberName: 'duelresults',
  14.             description: 'Records the results of your duel'
  15.         });
  16.     }
  17.  
  18.     async run(message, args)
  19.     {
  20.         let commandInfo = message.content.split(' ').slice(1);
  21.         let ladderName = commandInfo[0];
  22.         let otherPlayer = commandInfo[1].replace(/[<@>]/g, "");
  23.        
  24.         for(let i = 0; i < currentLadders.length; i++)
  25.         {
  26.             if(currentLadders[i].game === ladderName)
  27.             {
  28.                 for(let j = 0; j < currentLadders[i].players.length; j++)
  29.                 {
  30.                     if(message.author.id === currentLadders[i].players[j].ID)
  31.                     {
  32.                         for(let k = 0; k < currentLadders[i].players.length; k++)
  33.                         {
  34.                             if(otherPlayer === currentLadders[i].players[k].ID)
  35.                             {
  36.                                 message.channel.send(message.guild.member(otherPlayer) + ", if you agree with these results then react to the check otherwise react to the cross.")
  37.                                 message.react("❎")
  38.                                 message.react("✅")
  39.                                
  40.                                 const filter = (reaction, user) => reaction.emoji.name === '✅' && user.id === otherPlayer
  41.  
  42.                                 message.awaitReactions(filter, { time: 15000 })
  43.                                     .then(message.channel.send(message.author + " has beaten " + message.guild.member(otherPlayer) + " in a " + ladderName + " 1v1!"))
  44.                                     .catch(console.error);
  45.                             }
  46.                         }
  47.                         for(let k = 0; k < currentLadders[i].players.length; k++)
  48.                         {
  49.                             if(otherPlayer != currentLadders[i].players[k].ID)
  50.                             {
  51.                                 message.reply("that person is not in this ladder.")
  52.                                 return;
  53.                             }
  54.                         }
  55.                     }
  56.                     message.reply("you are not in the " + ladderName + " ladder, to join type !joinladder " + ladderName)
  57.                     return;
  58.                 }
  59.             }
  60.         }
  61.         let allLadders = '';
  62.         for(let i = 0; i < currentLadders.length; i++)
  63.         {
  64.             allLadders += "\n- " + currentLadders[i].game;
  65.         }
  66.         message.reply("that is not a ladder, these are though:" + allLadders)
  67.     }
  68. }
  69.  
  70. module.exports = duelResultsCommand;
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