diff options
Diffstat (limited to 'commands/Pokemon')
| -rw-r--r-- | commands/Pokemon/claim.js | 48 | ||||
| -rw-r--r-- | commands/Pokemon/dropgym.js | 18 | ||||
| -rw-r--r-- | commands/Pokemon/forcedrop.js | 19 | ||||
| -rw-r--r-- | commands/Pokemon/jointeam.js | 54 | ||||
| -rw-r--r-- | commands/Pokemon/leaveteam.js | 14 | ||||
| -rw-r--r-- | commands/Pokemon/lsitem.js | 20 | ||||
| -rw-r--r-- | commands/Pokemon/tradegym.js | 41 |
7 files changed, 131 insertions, 83 deletions
diff --git a/commands/Pokemon/claim.js b/commands/Pokemon/claim.js index 506ca0f..24880c4 100644 --- a/commands/Pokemon/claim.js +++ b/commands/Pokemon/claim.js @@ -9,46 +9,64 @@ exports.run = async (bot, msg) => { const isWhitelist = await bot.plugins.whitelist.isWhitelist(msg.guild.id); - if (!isWhitelist) return msg.reply ('This command is still in testing. Only whitelisted servers can use this command. Sorry!'); + if (!isWhitelist) { + return msg.reply('This command is still in testing. Only whitelisted servers can use this command. Sorry!'); + } - if (!msg.channel.name.startsWith('gym-')) return msg.reply('Go into one of the gym channels and try again.'); + 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)) { 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.'); + 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'); return msg.channel.setTopic(bot.plugins.gyms.getGymString(bot, msg.member)); } 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.'); + if (!team) { + return msg.reply('You have to join a team before you can claim a gym.'); + } const owner = bot.plugins.gyms.getOwnerId(msg.channel.topic); - if (msg.guild.members.find('id', owner).roles.find('name', team)) return msg.reply('Don\'t try battling your own team. They won\'t like you.'); + if (msg.guild.members.find('id', owner).roles.find('name', team)) { + return msg.reply('Don\'t try battling your own team. They won\'t like you.'); + } - if (bot.gyms.get(msg.channel.id) != null) return msg.reply('Nope, someone is already battling the gym.'); + if (bot.gyms.get(msg.channel.id) != null) { + return msg.reply('Nope, someone is already battling the gym.'); + } - msg.channel.send('<@' + owner + '>, come here as ' + msg.member.displayName + ' wants to battle you.'); + msg.channel.send(`<@${ owner }>, come here as ${ msg.member.displayName } wants to battle you.`); const func = async mess => { - if (mess.channel != msg.channel) return; + if (mess.channel != msg.channel) { + return; + } if (!mess.embeds[0] && !mess.embeds[0].description && !mess.embeds[0].description.split('\n')[0] && !mess.embeds[0].description.split('\n')[0].split(' ')[0] - ) return; + ) { + return; + } const field = mess.embeds[0].description.split('\n')[0].split(' ')[0]; const user = msg.guild.members.find(member => member.user.username === field); - if (!user) return; + if (!user) { + return; + } if (user.id == owner) { await msg.channel.send('The owner has not been defeated!'); - } - else if (user.id == msg.author.id) { + } else if (user.id == msg.author.id) { await msg.channel.send('The owner has been defeated! Transferring gym!'); await msg.channel.setTopic(bot.plugins.gyms.getGymString(bot, msg.member)); + } else { + return; } - else { return; } bot.gyms.set(msg.channel.id, null); bot.removeListener('message', func); }; @@ -58,10 +76,10 @@ exports.run = async (bot, msg) => { exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'claim', - description: 'Claim a gym.', + description: 'Claim a gym.' }; diff --git a/commands/Pokemon/dropgym.js b/commands/Pokemon/dropgym.js index cb9ad2e..c19c13f 100644 --- a/commands/Pokemon/dropgym.js +++ b/commands/Pokemon/dropgym.js @@ -9,17 +9,19 @@ exports.run = async (bot, msg) => { const isWhitelist = await bot.plugins.whitelist.isWhitelist(msg.guild.id); - if (!isWhitelist) return msg.reply ('This command is still in testing. Only whitelisted servers can use this command. Sorry!'); - if (!msg.channel.name.startsWith('gym-')) return msg.reply('Go into one of the gym channels and try again.'); + if (!isWhitelist) { + return msg.reply('This command is still in testing. Only whitelisted servers can use this command. Sorry!'); + } + if (!msg.channel.name.startsWith('gym-')) { + return msg.reply('Go into one of the gym channels and try again.'); + } if (msg.channel.topic == 'Current Owner: *none*') { msg.reply('There is no owner for this gym. Claim it now with p:claim!'); - } - else { + } else { const owner = msg.channel.topic.slice(15).substring(0, 18); if (msg.author.id != owner) { return msg.reply('You are not the owner of this gym.'); - } - else { + } else { msg.channel.setTopic('Current Owner: *none*'); msg.channel.send('You have dropped the gym.'); } @@ -28,10 +30,10 @@ exports.run = async (bot, msg) => { exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'dropgym', - description: 'Drop a gym.', + description: 'Drop a gym.' }; diff --git a/commands/Pokemon/forcedrop.js b/commands/Pokemon/forcedrop.js index bc2945d..7f29031 100644 --- a/commands/Pokemon/forcedrop.js +++ b/commands/Pokemon/forcedrop.js @@ -9,14 +9,19 @@ exports.run = async (bot, msg) => { const isWhitelist = await bot.plugins.whitelist.isWhitelist(msg.guild.id); - if (!isWhitelist) return msg.reply ('This command is still in testing. Only whitelisted servers can use this command. Sorry!'); + if (!isWhitelist) { + return msg.reply('This command is still in testing. Only whitelisted servers can use this command. Sorry!'); + } - if (!msg.member.hasPermission('MANAGE_MESSAGES')) return msg.reply('You don\'t have permission to force drop.'); - if (!msg.channel.name.startsWith('gym-')) return msg.reply('Go into one of the gym channels and try again.'); + if (!msg.member.hasPermission('MANAGE_MESSAGES')) { + return msg.reply('You don\'t have permission to force drop.'); + } + if (!msg.channel.name.startsWith('gym-')) { + return msg.reply('Go into one of the gym channels and try again.'); + } if (msg.channel.topic == 'Current Owner: *none*') { msg.reply('This gym does not have an owner.'); - } - else { + } else { msg.channel.setTopic('Current Owner: *none*'); msg.channel.send('You have dropped the gym.'); } @@ -24,10 +29,10 @@ exports.run = async (bot, msg) => { exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'forcedrop', - description: 'Force a gym to have no owner.', + description: 'Force a gym to have no owner.' }; diff --git a/commands/Pokemon/jointeam.js b/commands/Pokemon/jointeam.js index e396afe..d4f125f 100644 --- a/commands/Pokemon/jointeam.js +++ b/commands/Pokemon/jointeam.js @@ -9,27 +9,30 @@ exports.run = async (bot, msg, args) => { const isWhitelist = await bot.plugins.whitelist.isWhitelist(msg.guild.id); - if (!isWhitelist) return msg.reply ('This command is still in testing. Only whitelisted servers can use this command. Sorry!'); + if (!isWhitelist) { + return msg.reply('This command is still in testing. Only whitelisted servers can use this command. Sorry!'); + } - if (args.length < 1) return msg.reply('Please choose a team to join'); + if (args.length < 1) { + return msg.reply('Please choose a team to join'); + } const team = findTeam(msg, args[0].toUpperCase()); - switch (args[0]) - { - case 'skull': { - msg.member.addRole(msg.guild.roles.find('name', 'Skull')); - msg.reply(`Alright, ${team ? 'you have left team ' + team + ' and ' : 'you have '}joined team Skull.`); - break; - } - case 'flare' : { - msg.member.addRole(msg.guild.roles.find('name', 'Flare')); - msg.reply(`Alright, ${team ? 'you have left team ' + team + ' and ' : 'you have '}joined team Flare.`); - break; - } - default : { - msg.reply('You have to pick a team (skull, flare.)'); - break; - } + switch (args[0]) { + case 'skull': { + msg.member.addRole(msg.guild.roles.find('name', 'Skull')); + msg.reply(`Alright, ${team ? `you have left team ${ team } and ` : 'you have '}joined team Skull.`); + break; + } + case 'flare' : { + msg.member.addRole(msg.guild.roles.find('name', 'Flare')); + msg.reply(`Alright, ${team ? `you have left team ${ team } and ` : 'you have '}joined team Flare.`); + break; + } + default : { + msg.reply('You have to pick a team (skull, flare.)'); + break; + } } }; @@ -38,12 +41,15 @@ function findTeam(msg, team) { let oldTeam; if (msg.member.roles.find('name', 'Skull')) { - if (team == 'skull') return; + if (team == 'skull') { + return; + } msg.member.removeRole(msg.guild.roles.find('name', 'Skull')); oldTeam = 'Skull'; - } - else if (msg.member.roles.find('name', 'Flare')) { - if (team == 'flare') return; + } else if (msg.member.roles.find('name', 'Flare')) { + if (team == 'flare') { + return; + } msg.member.removeRole(msg.guild.roles.find('name', 'Flare')); oldTeam = 'Flare'; } @@ -52,11 +58,11 @@ function findTeam(msg, team) { exports.conf = { aliases: ['pick', 'choose'], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'jointeam', description: 'Join one of the teams!', - usage: '<flare/skull>', + usage: '<flare/skull>' }; diff --git a/commands/Pokemon/leaveteam.js b/commands/Pokemon/leaveteam.js index b2e1805..e1096a3 100644 --- a/commands/Pokemon/leaveteam.js +++ b/commands/Pokemon/leaveteam.js @@ -9,27 +9,27 @@ exports.run = async (bot, msg) => { const isWhitelist = await bot.plugins.whitelist.isWhitelist(msg.guild.id); - if (!isWhitelist) return msg.reply ('This command is still in testing. Only whitelisted servers can use this command. Sorry!'); + if (!isWhitelist) { + return msg.reply('This command is still in testing. Only whitelisted servers can use this command. Sorry!'); + } if (msg.member.roles.find('name', 'Skull')) { msg.member.removeRole(msg.guild.roles.find('name', 'Skull')); msg.reply('Alright, you are not longer in team Skull.'); - } - else if (msg.member.roles.find('name', 'Flare')) { + } else if (msg.member.roles.find('name', 'Flare')) { msg.member.removeRole(msg.guild.roles.find('name', 'Flare')); msg.reply('Alright, you are not longer in team Flare.'); - } - else { + } else { msg.reply('You are not in a team.'); } }; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'leaveteam', - description: 'Leave the team you currently are in.', + description: 'Leave the team you currently are in.' }; diff --git a/commands/Pokemon/lsitem.js b/commands/Pokemon/lsitem.js index fbdc4a0..8e8bdd8 100644 --- a/commands/Pokemon/lsitem.js +++ b/commands/Pokemon/lsitem.js @@ -8,34 +8,38 @@ * *************************************/ exports.run = async (bot, msg, args) => { - if (msg.guild.id != '417088992329334792') return msg.reply ('This command is still in early testing, so it is only available within Pokeworld.'); + if (msg.guild.id != '417088992329334792') { + return msg.reply('This command is still in early testing, so it is only available within Pokeworld.'); + } - const { RichEmbed } = require('discord.js'); + const {RichEmbed} = require('discord.js'); const data = args.join(' ').split('|'); - const msgs = await bot.channels.find('id', '637877120185532416').fetchMessages({ limit: 10 }); + const msgs = await bot.channels.find('id', '637877120185532416').fetchMessages({limit: 10}); const mess = msgs.first(); - if (!mess.embeds) return; + if (!mess.embeds) { + return; + } const id = parseInt(mess.embeds[0].author.name.split(':')[1]) + 1; bot.channels.find('id', '637877120185532416').send( new RichEmbed() .setTitle('A new pokemon is up for sale!') - .setAuthor('ID: ' + id) + .setAuthor(`ID: ${ id}`) .addField('Starting Price', data[1], true) .addField('Pokemon', data[0], true) .addField('Other', data[2], true) .addField('Seller', `<@${msg.author.id}>`, true) - .addField('How to bid', 'DM the seller for the pokemon giving them the id, ' + id) + .addField('How to bid', `DM the seller for the pokemon giving them the id, ${ id}`) ); }; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'lsitem', description: 'List an item to the marketplace.', - usage: '<pokemon>|<credits>|<other>', + usage: '<pokemon>|<credits>|<other>' }; diff --git a/commands/Pokemon/tradegym.js b/commands/Pokemon/tradegym.js index 5d981be..5f54333 100644 --- a/commands/Pokemon/tradegym.js +++ b/commands/Pokemon/tradegym.js @@ -9,34 +9,47 @@ exports.run = async (bot, msg) => { const isWhitelist = await bot.plugins.whitelist.isWhitelist(msg.guild.id); - if (!isWhitelist) return msg.reply ('This command is still in testing. Only whitelisted servers can use this command. Sorry!'); + if (!isWhitelist) { + return msg.reply('This command is still in testing. Only whitelisted servers can use this command. Sorry!'); + } - if (!msg.channel.name.startsWith('gym-')) return msg.reply('Go into one of the gym channels and try again.'); + 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', 'Skull')) team = 'Skull'; - if (msg.member.roles.find('name', 'Flare')) team = 'Flare'; - 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!'); + if (msg.member.roles.find('name', 'Skull')) { + team = 'Skull'; + } + if (msg.member.roles.find('name', 'Flare')) { + team = 'Flare'; + } + 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 ' + recipient); + msg.reply(`Trading gym to ${ recipient}`); let recipientTeam; - if (recipient.roles.find('name', 'Skull')) recipientTeam = 'Skull'; - if (recipient.roles.find('name', 'Flare')) recipientTeam = 'Flare'; - msg.channel.setTopic('Current Owner: ' + recipient.id + '/' + recipient.user.tag + '/' + recipientTeam); - } - else { + if (recipient.roles.find('name', 'Skull')) { + recipientTeam = 'Skull'; + } + if (recipient.roles.find('name', 'Flare')) { + recipientTeam = 'Flare'; + } + msg.channel.setTopic(`Current Owner: ${ recipient.id }/${ recipient.user.tag }/${ recipientTeam}`); + } else { msg.reply('You have to own the gym to be able to trade it!'); } }; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'tradegym', description: 'Trade a gym to the pinged member.', - usage: '@user', + usage: '@user' }; |
