Advertisement
Guest User

Untitled

a guest
Sep 14th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement