Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Error: (in discord no error shown in console)
- TypeError: message.awaitReactions is not a function
- const commando = require('discord.js-commando');
- class duelResultsCommand extends commando.Command
- {
- constructor(client)
- {
- super(client, {
- name: 'duelresults',
- group: 'simple',
- memberName: 'duelresults',
- description: 'Records the results of your duel'
- });
- }
- async run(message, args)
- {
- let commandInfo = message.content.split(' ').slice(1);
- let ladderName = commandInfo[0];
- let otherPlayer = commandInfo[1].replace(/[<@>]/g, "");
- for(let i = 0; i < currentLadders.length; i++)
- {
- if(currentLadders[i].game === ladderName)
- {
- for(let j = 0; j < currentLadders[i].players.length; j++)
- {
- if(message.author.id === currentLadders[i].players[j].ID)
- {
- for(let k = 0; k < currentLadders[i].players.length; k++)
- {
- if(otherPlayer === currentLadders[i].players[k].ID)
- {
- message.channel.send(message.guild.member(otherPlayer) + ", if you agree with these results then react to the check otherwise react to the cross.")
- message.react("❎")
- message.react("✅")
- const filter = (reaction, user) => reaction.emoji.name === '✅' && user.id === otherPlayer
- message.awaitReactions(filter, { time: 15000 })
- .then(message.channel.send(message.author + " has beaten " + message.guild.member(otherPlayer) + " in a " + ladderName + " 1v1!"))
- .catch(console.error);
- }
- }
- for(let k = 0; k < currentLadders[i].players.length; k++)
- {
- if(otherPlayer != currentLadders[i].players[k].ID)
- {
- message.reply("that person is not in this ladder.")
- return;
- }
- }
- }
- message.reply("you are not in the " + ladderName + " ladder, to join type !joinladder " + ladderName)
- return;
- }
- }
- }
- let allLadders = '';
- for(let i = 0; i < currentLadders.length; i++)
- {
- allLadders += "\n- " + currentLadders[i].game;
- }
- message.reply("that is not a ladder, these are though:" + allLadders)
- }
- }
- module.exports = duelResultsCommand;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement