diff options
| author | pokesudenk <thisis@notarealema.il> | 2018-02-25 13:12:48 -0500 |
|---|---|---|
| committer | pokesudenk <thisis@notarealema.il> | 2018-02-25 13:12:48 -0500 |
| commit | ea674831bf2139fa295f6c9d532036354bb36f1e (patch) | |
| tree | 2048c8f0424ba4766add3eaa4389a287ff9cda9a /commands/Pokemon | |
| parent | c2ed17bc46fa025f15b7fc4007ec3546c7823b4b (diff) | |
| download | PokeBot-ea674831bf2139fa295f6c9d532036354bb36f1e.tar.gz PokeBot-ea674831bf2139fa295f6c9d532036354bb36f1e.tar.bz2 PokeBot-ea674831bf2139fa295f6c9d532036354bb36f1e.zip | |
trying to fix tradegym plugin
Diffstat (limited to 'commands/Pokemon')
| -rw-r--r-- | commands/Pokemon/tradegym.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/commands/Pokemon/tradegym.js b/commands/Pokemon/tradegym.js index b3ccb0c..7ce3664 100644 --- a/commands/Pokemon/tradegym.js +++ b/commands/Pokemon/tradegym.js @@ -19,6 +19,7 @@ * *************************************/ 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'; @@ -26,14 +27,14 @@ exports.run = async (bot, msg, args) => { 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!'); |
