From b41df418dcaa114a173b0eec234b4b71f91b7318 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 5 Apr 2018 20:18:43 -0400 Subject: gyms system --- plugins/gyms.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 plugins/gyms.js (limited to 'plugins/gyms.js') diff --git a/plugins/gyms.js b/plugins/gyms.js new file mode 100644 index 0000000..d4b1afe --- /dev/null +++ b/plugins/gyms.js @@ -0,0 +1,34 @@ +/** ************************************** + * + * Gyms: Plugin for PokeBot that enables gym features. + * Copyright (C) 2018 TheEdge, jtsshieh, Alee + * + * Licensed under the Open Software License version 3.0 + * + * *************************************/ + +exports.isTeam = (member) => { + let team; + if (member.roles.find('name', 'Skull')) team = 'Skull'; + if (member.roles.find('name', 'Flare')) team = 'Flare'; + return team ? true : false; +}; + +exports.getTeam = (member) => { + let team; + if (member.roles.find('name', 'Skull')) team = 'Skull'; + if (member.roles.find('name', 'Flare')) team = 'Flare'; + return team; +}; + +exports.getOwnerId = (title) => { + return title.slice(15).substring(0, 18); +}; + +exports.getGymString = (bot, member) => { + return 'Current Owner: ' + member.id + '/' + member.user.tag + '/' + bot.plugins.gyms.getTeam(member); +}; + +exports.isOwned = (title) => { + return title != 'Current Owner: *none*'; +}; -- cgit v1.2.3 From 0e5738a216d7eceb7655039d5320a922aec270e2 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 5 Apr 2018 20:26:21 -0400 Subject: bugs --- plugins/gyms.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/gyms.js') diff --git a/plugins/gyms.js b/plugins/gyms.js index d4b1afe..3f1ce29 100644 --- a/plugins/gyms.js +++ b/plugins/gyms.js @@ -30,5 +30,5 @@ exports.getGymString = (bot, member) => { }; exports.isOwned = (title) => { - return title != 'Current Owner: *none*'; + return title == 'Current Owner: *none*'; }; -- cgit v1.2.3 From addf70683d681cd357133f93218b7a9b7a99fbe3 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 5 Apr 2018 20:31:07 -0400 Subject: bugs --- commands/Pokemon/claim.js | 2 +- plugins/gyms.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/gyms.js') diff --git a/commands/Pokemon/claim.js b/commands/Pokemon/claim.js index 00a9188..f3d836e 100644 --- a/commands/Pokemon/claim.js +++ b/commands/Pokemon/claim.js @@ -13,7 +13,7 @@ exports.run = async (bot, msg) => { if (!msg.channel.name.startsWith('gym-')) return msg.reply('Go into one of the gym channels and try again.'); - if (bot.plugins.gyms.isOwned(msg.channel.topic)) { + if (!bot.plugins.gyms.isOwned(msg.channel.topic)) { const team = bot.plugins.gyms.getTeam(msg.member); if (!team) return msg.reply('You have to join a team before you can claim a gym.'); msg.reply('Alright, you have claimed this gym as yours! Be ready to battle anyone who approaches you'); diff --git a/plugins/gyms.js b/plugins/gyms.js index 3f1ce29..d4b1afe 100644 --- a/plugins/gyms.js +++ b/plugins/gyms.js @@ -30,5 +30,5 @@ exports.getGymString = (bot, member) => { }; exports.isOwned = (title) => { - return title == 'Current Owner: *none*'; + return title != 'Current Owner: *none*'; }; -- cgit v1.2.3