Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Commit

Permalink
trying to fix tradegym plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
pokesudenk committed Feb 25, 2018
1 parent c2ed17b commit ea67483
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions commands/Pokemon/tradegym.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,22 @@
* *************************************/

exports.run = async (bot, msg, args) => {

if (!msg.channel.name.startsWith('gym-')) return msg.reply('Go into one of the gym channels and try again.');
let team;
if (msg.member.roles.find('name', 'Aqua')) team = 'Aqua';
if (msg.member.roles.find('name', 'Rocket')) team = 'Rocket';
if (msg.member.roles.find('name', 'Magma')) team = 'Magma';
if (msg.channel.topic == 'Current Owner: ' + msg.author.id + '/' + msg.author.tag + '/' + team) {
if (!msg.mentions.members.first()) return msg.reply('Sorry, you have to ping the recipient of the gym!');

const recipient = msg.mentions.members.first();

msg.reply('Trading gym to '+ msg.mentions.members.first());
msg.reply('Trading gym to ' + recipient);
let recipientTeam;
if (msg.mentions.members.first.roles.find('name', 'Aqua')) recipientTeam = 'Aqua';
if (msg.mentions.members.first.roles.find('name', 'Rocket')) recipientTeam = 'Rocket';
if (msg.mentions.members.first().roles.find('name', 'Magma')) recipientTeam = 'Magma';
msg.channel.setTopic('Current Owner: ' + msg.mentions.members.first().id + '/' + msg.mentions.members.first().tag + '/' + recipientTeam);
if (recipient.roles.find('name', 'Aqua')) recipientTeam = 'Aqua';
if (recipient.roles.find('name', 'Rocket')) recipientTeam = 'Rocket';
if (recipient.roles.find('name', 'Magma')) recipientTeam = 'Magma';
msg.channel.setTopic('Current Owner: ' + recipient.id + '/' + recipient.tag + '/' + recipientTeam);
}
else {
msg.reply('You have to own the gym to be able to trade it!');
Expand Down

0 comments on commit ea67483

Please sign in to comment.