diff options
Diffstat (limited to 'commands')
44 files changed, 552 insertions, 402 deletions
diff --git a/commands/Fun/8ball.js b/commands/Fun/8ball.js index 48f53e0..23846a3 100644 --- a/commands/Fun/8ball.js +++ b/commands/Fun/8ball.js @@ -7,8 +7,10 @@ * * *************************************/ -exports.run = async (bot, msg, args) => { - if (args.length < 1) return msg.reply('You need to ask the 8-ball something for it to respond!'); +exports.run = (bot, msg, args) => { + if (args.length < 1) { + return msg.reply('You need to ask the 8-ball something for it to respond!'); + } const responses = [ 'May the odds ever be in your favor...', @@ -38,19 +40,19 @@ exports.run = async (bot, msg, args) => { 'My reply is no', 'My sources say no', 'Outlook not so good', - 'Very doubtful', + 'Very doubtful' ]; - msg.channel.send(':8ball: *' + (responses[Math.floor(Math.random() * responses.length)]) + '*'); + msg.channel.send(`:8ball: *${responses[Math.floor(Math.random() * responses.length)]}*`); }; exports.conf = { aliases: ['ask'], - guildOnly: true, + guildOnly: true }; exports.help = { name: '8ball', description: 'Ask the magic 8-ball something. It will answer back, and be as much of a smart-alac as it wants to.', - usage: '<...question>', + usage: '<...question>' }; diff --git a/commands/Fun/balance.js b/commands/Fun/balance.js index afe094e..1a7995b 100644 --- a/commands/Fun/balance.js +++ b/commands/Fun/balance.js @@ -9,15 +9,15 @@ exports.run = async (bot, msg) => { const credits = await bot.plugins.economy.get(msg.author.id); - msg.reply(credits + ' credits'); + msg.reply(`${credits} credits`); }; exports.conf = { aliases: ['bal', 'money', 'credits'], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'balance', - description: 'Check your balance!', + description: 'Check your balance!' }; diff --git a/commands/Fun/cureboredom.js b/commands/Fun/cureboredom.js index 4b99406..f9ae256 100644 --- a/commands/Fun/cureboredom.js +++ b/commands/Fun/cureboredom.js @@ -26,20 +26,22 @@ exports.run = (bot, msg, args) => { 'Messing with Rich Presence :gear:', 'Making videos :movie_camera:', 'Taking pictures :camera:', - 'Suggesting things for the server :dancers:', + 'Suggesting things for the server :dancers:' ]; - if (args[0] === 'list') return msg.channel.send(ideas.join('\n')); + if (args[0] === 'list') { + return msg.channel.send(ideas.join('\n')); + } msg.channel.send(ideas[Math.floor(Math.random() * ideas.length)]); }; exports.conf = { aliases: ['cboredom'], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'cureboredom', - description: 'Finds you something to do.', + description: 'Finds you something to do.' }; diff --git a/commands/Fun/findmyphone.js b/commands/Fun/findmyphone.js index 135d449..bb930ef 100644 --- a/commands/Fun/findmyphone.js +++ b/commands/Fun/findmyphone.js @@ -19,7 +19,7 @@ exports.run = (bot, msg) => { 'Stockton', 'Colorado Springs', 'Portland', - 'Cincinnati', + 'Cincinnati' ]; msg.channel.send(cities[Math.floor(Math.random() * cities.length)]); @@ -27,10 +27,10 @@ exports.run = (bot, msg) => { exports.conf = { aliases: ['findphone', 'findmyiphone', 'findmyandroid', 'findmyandroidphone'], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'findmyphone', - description: 'Find your phone. Not just a random list of cities being randomly picked.', + description: 'Find your phone. Not just a random list of cities being randomly picked.' }; diff --git a/commands/Fun/gamble.js b/commands/Fun/gamble.js index 7921993..8e599dc 100644 --- a/commands/Fun/gamble.js +++ b/commands/Fun/gamble.js @@ -17,55 +17,73 @@ exports.run = async (bot, msg) => { 6, 7, 8, - 9, + 9 ]; const balance = await bot.plugins.economy.get(msg.author.id); - if (balance < 10) return await msg.reply('You don\'t have enough credits (10) to play the slots'); + if (balance < 10) { + return msg.reply('You don\'t have enough credits (10) to play the slots'); + } const number1 = slotNumbers[Math.floor(Math.random() * slotNumbers.length)]; const number2 = slotNumbers[Math.floor(Math.random() * slotNumbers.length)]; const number3 = slotNumbers[Math.floor(Math.random() * slotNumbers.length)]; - if (number2 == number1 + 1 && number3 == number2 + 1) { + if (number2 == number1 + 1 && number3 == number2 + 1) { await bot.plugins.economy.add(msg.author.id, 1000); const balance = await bot.plugins.economy.get(msg.author.id); - return await msg.channel.send('You won 1000 credits!\nCurrent Balance: ' + balance + ' \n> ' + emojify(number1, number2, number3)); - } - else if (number2 == number3 - 1 && number1 == number2 - 1) { + return msg.channel.send(`You won 1000 credits!\nCurrent Balance: ${ balance } \n> ${ emojify(number1, number2, number3)}`); + } else if (number2 == number3 - 1 && number1 == number2 - 1) { await bot.plugins.economy.add(msg.author.id, 1500); const balance = await bot.plugins.economy.get(msg.author.id); - return await msg.channel.send('You won 1500 credits!\nCurrent Balance: ' + balance + ' \n> ' + emojify(number1, number2, number3)); - } - else { + return msg.channel.send(`You won 1500 credits!\nCurrent Balance: ${ balance } \n> ${ emojify(number1, number2, number3)}`); + } else { await bot.plugins.economy.subtract(msg.author.id, 10); const balance = await bot.plugins.economy.get(msg.author.id); - return await msg.channel.send('Aww, you lost! Better luck next time.\nCurrent Balance: ' + balance + ' \n> ' + emojify(number1, number2, number3)); + return msg.channel.send(`Aww, you lost! Better luck next time.\nCurrent Balance: ${ balance } \n> ${ emojify(number1, number2, number3)}`); } }; function emojify(number1, number2, number3) { - return emote(number1) + ' ' + emote(number2) + ' ' + emote(number3); + return `${emote(number1) } ${ emote(number2) } ${ emote(number3)}`; } function emote(number) { - if (number == 1) return ':one:'; - if (number == 2) return ':two:'; - if (number == 3) return ':three:'; - if (number == 4) return ':four:'; - if (number == 5) return ':five:'; - if (number == 6) return ':six:'; - if (number == 7) return ':seven:'; - if (number == 8) return ':eight:'; - if (number == 9) return ':nine:'; + if (number == 1) { + return ':one:'; + } + if (number == 2) { + return ':two:'; + } + if (number == 3) { + return ':three:'; + } + if (number == 4) { + return ':four:'; + } + if (number == 5) { + return ':five:'; + } + if (number == 6) { + return ':six:'; + } + if (number == 7) { + return ':seven:'; + } + if (number == 8) { + return ':eight:'; + } + if (number == 9) { + return ':nine:'; + } } exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'gamble', - description: 'Develop a gambling addiction by playing Slots!', + description: 'Develop a gambling addiction by playing Slots!' }; diff --git a/commands/Fun/jobs.js b/commands/Fun/jobs.js index f71ba28..d71ac31 100644 --- a/commands/Fun/jobs.js +++ b/commands/Fun/jobs.js @@ -9,31 +9,32 @@ const cooldown = new Set(); exports.run = (bot, msg) => { - if (cooldown.has(msg.author.id)) return msg.reply('You have worked too recently'); + if (cooldown.has(msg.author.id)) { + return msg.reply('You have worked too recently'); + } const jobs = [ - "started a BitCoin farm", - "pissed for an elderly woman", - "became a doctor and illegally sold organs", - "extracted eggs from elderly women", - "became a bus driver", - "started working for Universe Dev Group", - "programmed a Discord bot", - "made a crowdfunding campaign", - "became a news anchor", - "flooded Amsterdam", - "became YouTube famous.", - ] + 'started a BitCoin farm', + 'pissed for an elderly woman', + 'became a doctor and illegally sold organs', + 'extracted eggs from elderly women', + 'became a bus driver', + 'started working for Universe Dev Group', + 'programmed a Discord bot', + 'made a crowdfunding campaign', + 'became a news anchor', + 'flooded Amsterdam', + 'became YouTube famous.' + ]; if (bot.dbl.hasVoted(msg.author.id)) { - var creditsEarned = Math.floor(Math.random() * 650); + const creditsEarned = Math.floor(Math.random() * 650); bot.plugins.economy.add(msg.author.id, creditsEarned); - msg.channel.send('You worked and ' + jobs[Math.floor(Math.random() * jobs.length)] + '\n\nYou earned ' + creditsEarned.toString() + ' credits.'); - } - else { - var creditsEarned = Math.floor(Math.random() * 250); + msg.channel.send(`You worked and ${ jobs[Math.floor(Math.random() * jobs.length)] }\n\nYou earned ${ creditsEarned.toString() } credits.`); + } else { + const creditsEarned = Math.floor(Math.random() * 250); bot.plugins.economy.add(msg.author.id, creditsEarned); - msg.channel.send('You worked and ' + jobs[Math.floor(Math.random() * jobs.length)] + '\n\nYou earned ' + creditsEarned.toString() + ' credits.'); + msg.channel.send(`You worked and ${ jobs[Math.floor(Math.random() * jobs.length)] }\n\nYou earned ${ creditsEarned.toString() } credits.`); } cooldown.add(msg.author.id); setTimeout(() => { @@ -43,10 +44,10 @@ exports.run = (bot, msg) => { exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'jobs', - description: 'Work to add credits to your account.', + description: 'Work to add credits to your account.' }; diff --git a/commands/Fun/og151.js b/commands/Fun/og151.js index d2b3ccf..d14d7dd 100644 --- a/commands/Fun/og151.js +++ b/commands/Fun/og151.js @@ -159,7 +159,7 @@ exports.run = (bot, msg) => { 'Weezing', 'Wigglytuff', 'Zapdos', - 'Zubat', + 'Zubat' ]; msg.channel.send(pokemon[Math.floor(Math.random() * pokemon.length)]); @@ -167,10 +167,10 @@ exports.run = (bot, msg) => { exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'og151', - description: 'Randomly picks one of the generation 1 pokemon, and gives you its name.', + description: 'Randomly picks one of the generation 1 pokemon, and gives you its name.' }; diff --git a/commands/Fun/ship.js b/commands/Fun/ship.js index ba31db5..499ab06 100644 --- a/commands/Fun/ship.js +++ b/commands/Fun/ship.js @@ -8,15 +8,15 @@ * *************************************/ exports.run = (bot, msg) => { - msg.channel.send(msg.author.username + ' x ' + msg.guild.members.random().displayName + ' :cruise_ship:'); + msg.channel.send(`${msg.author.username} x ${msg.guild.members.random().displayName} :cruise_ship:`); }; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'ship', - description: 'Test the luck of your love life! Ships you with another user.', + description: 'Test the luck of your love life! Ships you with another user.' }; diff --git a/commands/Fun/story.js b/commands/Fun/story.js index c35e3e7..b8a6da6 100644 --- a/commands/Fun/story.js +++ b/commands/Fun/story.js @@ -8,40 +8,38 @@ * *************************************/ exports.run = async (bot, msg) => { - msg.guild.fetchMembers().then(guild => - { - const membersList = guild.members.array(); - const selectedUser1 = membersList[Math.floor(Math.random() * membersList.length)].user; - const selectedUser2 = membersList[Math.floor(Math.random() * membersList.length)].user; - const selectedUser3 = membersList[Math.floor(Math.random() * membersList.length)].user; - const selectedUser4 = membersList[Math.floor(Math.random() * membersList.length)].user; + const guild = await msg.guild.fetchMembers(); + const membersList = guild.members.array(); + const selectedUser1 = membersList[Math.floor(Math.random() * membersList.length)].user; + const selectedUser2 = membersList[Math.floor(Math.random() * membersList.length)].user; + const selectedUser3 = membersList[Math.floor(Math.random() * membersList.length)].user; + const selectedUser4 = membersList[Math.floor(Math.random() * membersList.length)].user; - const stories = + const stories = [ `${selectedUser1.username} bought ${selectedUser2.username} his favorite video game. This game is called "Pokemon". Then, they became best friends.`, `${selectedUser1.username} wants to become a Pokemon trainer, but he needs to get a Pokemon first!`, `One day, ${selectedUser1.username} decided to go to a shop. He took his motorbike. Once he arrived at the shop, he went inside. He headed right, towards the chips. He grabbed a packet, and headed to check-out. He bumped into ${selectedUser2.username} at the counter, and decided to say hi. They had a little chat, and then decided to gossip about ${selectedUser3.username}. Then, as they were saying some horrible things about ${selectedUser3.username}, they unexpectedly showed up! Then, ${selectedUser1.username} and ${selectedUser2.username} got into a fight against ${selectedUser3.username}.\n\nKids, this is why you don't start drama.\nNow ${selectedUser1.username}, ${selectedUser2.username}, and ${selectedUser3.username} are no longer friends.`, `At a point in time, ${selectedUser1.username} was battling ${selectedUser2.username} for a gym. ${selectedUser1.username} chose Sylveon to battle, when ${selectedUser2.username} chose their trusty Eevee. First, Eevee used Tackle, when Sylveon went in for Draining Kiss. Then, ${selectedUser2.username} shouted an expletive. Once they shouted it, ${selectedUser3.username} came inside the room. ${selectedUser3.username} does not like expletives, so they got into an arguement about them. Soon enough, vicr123 got in here too and started using "-" in place of expletives during the argument. Eventually, ${selectedUser2.username} and ${selectedUser3.username} were shouting expletives at each-other, vicr123 was audibly shouting "Dash! Dash you!", while ${selectedUser1.username} was smashing his head on his desk.`, `It was the day of the release of Pokemon Ultra Sun and Ultra Moon. ${selectedUser1.username} and ${selectedUser2.username} decided to go to GameStop to wait in line to grab their pre-order copies. Then, ${selectedUser3.username} came along, and got mad once they realised ${selectedUser1.username} and ${selectedUser2.username} had pre-orders, when ${selectedUser3.username} did not. Eventually, ${selectedUser3.username} started physically assaulting ${selectedUser1.username} when they came outside with their pre-order copy. Then, known police officer ${selectedUser4.username} came up to ${selectedUser3.username} and ${selectedUser1.username} and charged them both for Indecent Exposure, and Assault of the Second Degree.\n\nMoral of the story: Do not get into an assualt over a video-game, like ${selectedUser3.username} and ${selectedUser1.username} did.`, - `${selectedUser1.username} played this new game called Pokemon (this is back in 1996) and his friend ${selectedUser2.username} also bought that game. And then Victor Tran decided to say "Ooh! What's that game". Then ${selectedUser2.username} said "It's Pokemon!". Then Victor said "- you...", after that ${selectedUser1.username} facepalmed.`, + `${selectedUser1.username} played this new game called Pokemon (this is back in 1996) and his friend ${selectedUser2.username} also bought that game. And then Victor Tran decided to say "Ooh! What's that game". Then ${selectedUser2.username} said "It's Pokemon!". Then Victor said "- you...", after that ${selectedUser1.username} facepalmed.` ]; - const storySelected = [Math.floor(Math.random() * stories.length)]; - const { RichEmbed } = require('discord.js'); - const embed = new RichEmbed() - .setColor(0x00ae86) - .setTitle('PokeBot Storytime') - .setDescription(stories[storySelected]) - .setFooter('PokeBot v1.0'); - msg.channel.send({ embed }); - }); + const storySelected = [Math.floor(Math.random() * stories.length)]; + const {RichEmbed} = require('discord.js'); + const embed = new RichEmbed() + .setColor(0x00ae86) + .setTitle('PokeBot Storytime') + .setDescription(stories[storySelected]) + .setFooter('PokeBot v1.0'); + msg.channel.send({embed}); }; exports.conf = { aliases: ['storytime'], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'story', - description: 'Tells you a story.', + description: 'Tells you a story.' }; diff --git a/commands/Getting Started/contribute.js b/commands/Getting Started/contribute.js index 15204fd..66a3511 100644 --- a/commands/Getting Started/contribute.js +++ b/commands/Getting Started/contribute.js @@ -13,10 +13,10 @@ exports.run = (bot, msg) => { exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'contribute', - description: 'Contributing to the bot.', + description: 'Contributing to the bot.' }; diff --git a/commands/Getting Started/help.js b/commands/Getting Started/help.js index 03dc3de..e1325d1 100644 --- a/commands/Getting Started/help.js +++ b/commands/Getting Started/help.js @@ -8,12 +8,12 @@ * *************************************/ exports.run = (bot, msg, args) => { - const { RichEmbed } = require('discord.js'); + const {RichEmbed} = require('discord.js'); if (!args[0]) { - const settings = require("../../assets/settings.json"); + const settings = require('../../assets/settings.json'); const embed = new RichEmbed(); embed - .setColor (0x36393e) + .setColor(0x36393e) .setTitle('PokeBot Command List') .setDescription(`PokeBot prefix is \`${settings.prefix}\`.`) .setFooter(`PokeBot v1.0 is on ${bot.guilds.size} servers.`); @@ -25,23 +25,22 @@ exports.run = (bot, msg, args) => { commands.forEach(cmd => { const command = bot.commands.get(x).get(cmd); if (command.checkPermission != null) { - if (command.checkPermission(bot, msg.member) == true) - { + if (command.checkPermission(bot, msg.member) == true) { cat += `**${command.help.name}**\n`; } - } - else { + } else { cat += `**${command.help.name}**\n`; } }); - if (cat != '') embed.addField(x, cat, true); + if (cat != '') { + embed.addField(x, cat, true); + } }); - msg.channel.send({ embed }); - } - else { + msg.channel.send({embed}); + } else { const embed = new RichEmbed(); embed - .setColor (0x00ae86) + .setColor(0x00ae86) .setDescription('Notice: When using a command do not include "<" and ">".\n(Example: p:suggest Test)') .setFooter('PokeBot v1.0'); @@ -56,7 +55,7 @@ exports.run = (bot, msg, args) => { embed.addField('Description', command.help.description, true); embed.addField('Usage', usage, true); embed.addField('Aliases', command.conf.aliases, true); - msg.channel.send({ embed }); + msg.channel.send({embed}); } }); }); @@ -65,10 +64,10 @@ exports.run = (bot, msg, args) => { exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'help', - description: 'Displays this help message.', + description: 'Displays this help message.' }; diff --git a/commands/Getting Started/ping.js b/commands/Getting Started/ping.js index 365c9f4..17d5456 100644 --- a/commands/Getting Started/ping.js +++ b/commands/Getting Started/ping.js @@ -8,15 +8,15 @@ * *************************************/ exports.run = (bot, msg) => { - msg.channel.send(':ping_pong: Pong! ' + Math.floor(bot.ping) + 'ms.'); + msg.channel.send(`:ping_pong: Pong! ${ Math.floor(bot.ping)}ms.`); }; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'ping', - description: 'Pings the bot and replies with the latency.', + description: 'Pings the bot and replies with the latency.' }; diff --git a/commands/Getting Started/start.js b/commands/Getting Started/start.js index aa8eb9f..152cc5b 100644 --- a/commands/Getting Started/start.js +++ b/commands/Getting Started/start.js @@ -8,8 +8,10 @@ * *************************************/ exports.run = (bot, msg) => { - const { RichEmbed } = require('discord.js'); - if (msg.guild.id != '417088992329334792') return msg.reply ('This is a PokeWorld exclusive command. Sorry!'); + const {RichEmbed} = require('discord.js'); + if (msg.guild.id != '417088992329334792') { + return msg.reply('This is a PokeWorld exclusive command. Sorry!'); + } msg.channel.send( new RichEmbed() .setColor(0x00ae86) @@ -23,10 +25,10 @@ exports.run = (bot, msg) => { exports.conf = { aliases: ['noobs', 'newcomers'], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'start', - description: 'Introduces you to the PokeWorld server!', + description: 'Introduces you to the PokeWorld server!' }; diff --git a/commands/Moderation/ban.js b/commands/Moderation/ban.js index 593d9e7..a4da613 100644 --- a/commands/Moderation/ban.js +++ b/commands/Moderation/ban.js @@ -8,21 +8,25 @@ * *************************************/ exports.run = async (bot, msg, args) => { - if (!msg.guild.member(bot.user).hasPermission('BAN_MEMBERS')) return msg.reply('I don\'t have permission to ban members.'); + if (!msg.guild.member(bot.user).hasPermission('BAN_MEMBERS')) { + return msg.reply('I don\'t have permission to ban members.'); + } const member = msg.mentions.members.first(); - if (!member) return await msg.reply('Who am I gonna ban? (Remember to @mention them)'); + if (!member) { + return msg.reply('Who am I gonna ban? (Remember to @mention them)'); + } const reason = args.join(' ').slice(3 + member.user.id.length); - await member.ban({ days: 7, reason: msg.author.tag + (reason ? ': ' + reason : '') }) - .catch(err => { - msg.reply('There was an error.'); return console.error(err.stack); - }) - .then(() => { - msg.channel.send(`Alright, I banned **${member.user.tag}**${(reason ? ` for the reason **${reason}**.` : '.')}`); - }); + try { + await member.ban({days: 7, reason: msg.author.tag + (reason ? `: ${ reason}` : '')}); + msg.channel.send(`Alright, I banned **${member.user.tag}**${(reason ? ` for the reason **${reason}**.` : '.')}`); + + } catch(err) { + msg.reply('There was an error.'); return console.error(err.stack); + } - const { RichEmbed } = require('discord.js'); + const {RichEmbed} = require('discord.js'); try { const embed = new RichEmbed() .setColor(0x00ae86) @@ -34,25 +38,26 @@ exports.run = async (bot, msg, args) => { .setTimestamp() .setFooter(`${msg.author.tag} banned ${member.user.tag}`, msg.author.avatarURL); const logChannel = await bot.plugins.settings.getStr('logs', msg.guild.id); - msg.guild.channels.find('id', logChannel).send({ embed }); - } - catch (err) { + msg.guild.channels.find('id', logChannel).send({embed}); + } catch (err) { console.error(err.stack); } }; exports.checkPermission = (bot, member) => { - if (!member.hasPermission('BAN_MEMBERS')) return 'You don\'t have permission to ban members.'; + if (!member.hasPermission('BAN_MEMBERS')) { + return 'You don\'t have permission to ban members.'; + } return true; -} +}; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'ban', description: 'Ban a user from this server.', - usage: '@user <...reason>', + usage: '@user <...reason>' }; diff --git a/commands/Moderation/interrogate.js b/commands/Moderation/interrogate.js index 39c10a1..2706f69 100644 --- a/commands/Moderation/interrogate.js +++ b/commands/Moderation/interrogate.js @@ -8,16 +8,22 @@ * *************************************/ exports.run = async (bot, msg) => { - if (msg.guild.id != '417088992329334792') return msg.reply ('This is a PokeWorld exclusive command. Sorry!'); + if (msg.guild.id != '417088992329334792') { + return msg.reply('This is a PokeWorld exclusive command. Sorry!'); + } - if (!msg.guild.member(bot.user).hasPermission('MANAGE_ROLES')) return msg.reply('I cannot interrogate anyone.'); + if (!msg.guild.member(bot.user).hasPermission('MANAGE_ROLES')) { + return msg.reply('I cannot interrogate anyone.'); + } const member = msg.mentions.members.first(); - if (!member) return await msg.reply('Who shall I interrogate? (Remember to @mention them)'); + if (!member) { + return msg.reply('Who shall I interrogate? (Remember to @mention them)'); + } member.addRole(msg.guild.roles.find('name', 'Interrogation')); - const { RichEmbed } = require('discord.js'); + const {RichEmbed} = require('discord.js'); try { const embed = new RichEmbed() .setColor(0x00ae86) @@ -28,25 +34,26 @@ exports.run = async (bot, msg) => { .setTimestamp() .setFooter(`${msg.author.tag} interrogated ${member.user.tag}.`, msg.author.avatarURL); const logChannel = await bot.plugins.settings.getStr('logs', msg.guild.id); - msg.guild.channels.find('id', logChannel).send({ embed }); - } - catch (err) { + msg.guild.channels.find('id', logChannel).send({embed}); + } catch (err) { console.error(err.stack); } }; exports.checkPermission = (bot, member) => { - if (!member.hasPermission('BAN_MEMBERS')) return 'You don\'t have permission to interrogate others. Rip-off detectives...'; + if (!member.hasPermission('BAN_MEMBERS')) { + return 'You don\'t have permission to interrogate others. Rip-off detectives...'; + } return true; -} +}; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'interrogate', description: 'Interrogate a suspect/user.', - usage: '@user', + usage: '@user' }; diff --git a/commands/Moderation/jail.js b/commands/Moderation/jail.js index 87d18da..6cb65b9 100644 --- a/commands/Moderation/jail.js +++ b/commands/Moderation/jail.js @@ -8,16 +8,22 @@ * *************************************/ exports.run = async (bot, msg) => { - if (msg.guild.id != '417088992329334792') return msg.reply ('This is a PokeWorld exclusive command. Sorry!'); + if (msg.guild.id != '417088992329334792') { + return msg.reply('This is a PokeWorld exclusive command. Sorry!'); + } - if (!msg.guild.member(bot.user).hasPermission('MANAGE_ROLES')) return msg.reply('I cannot put anyone in jail.'); + if (!msg.guild.member(bot.user).hasPermission('MANAGE_ROLES')) { + return msg.reply('I cannot put anyone in jail.'); + } const member = msg.mentions.members.first(); - if (!member) return await msg.reply('Who do I put in jail? (Remember to @mention them)'); + if (!member) { + return msg.reply('Who do I put in jail? (Remember to @mention them)'); + } member.addRole(msg.guild.roles.find('name', 'Jail')); - const { RichEmbed } = require('discord.js'); + const {RichEmbed} = require('discord.js'); try { const embed = new RichEmbed() .setColor(0x00ae86) @@ -28,25 +34,26 @@ exports.run = async (bot, msg) => { .setTimestamp() .setFooter(`${msg.author.tag} put ${member.user.tag} in jail.`, msg.author.avatarURL); const logChannel = await bot.plugins.settings.getStr('logs', msg.guild.id); - msg.guild.channels.find('id', logChannel).send({ embed }); - } - catch (err) { + msg.guild.channels.find('id', logChannel).send({embed}); + } catch (err) { console.error(err.stack); } }; exports.checkPermission = (bot, member) => { - if (!member.hasPermission('BAN_MEMBERS')) return 'You don\'t have permission to put members in jail.'; + if (!member.hasPermission('BAN_MEMBERS')) { + return 'You don\'t have permission to put members in jail.'; + } return true; -} +}; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'jail', description: 'Jail a user.', - usage: '@user', + usage: '@user' }; diff --git a/commands/Moderation/kick.js b/commands/Moderation/kick.js index 3ee88ea..386e5cb 100644 --- a/commands/Moderation/kick.js +++ b/commands/Moderation/kick.js @@ -8,29 +8,37 @@ * *************************************/ exports.run = async (bot, msg, args) => { - if (!msg.guild.member(bot.user).hasPermission('KICK_MEMBERS')) return msg.reply('I don\'t have permission to kick members.'); + if (!msg.guild.member(bot.user).hasPermission('KICK_MEMBERS')) { + return msg.reply('I don\'t have permission to kick members.'); + } const member = msg.mentions.members.first(); - if (!member) return await msg.reply('Who am I gonna kick? (Remember to @mention them)'); + if (!member) { + return msg.reply('Who am I gonna kick? (Remember to @mention them)'); + } const reason = args.join(' ').slice(3 + member.user.id.length); - await member.kick(msg.author.tag + ': ' + (reason ? ': ' + reason : '')) - .catch(err => { msg.reply('There was an error.'); console.error(err.stack);}); + await member.kick(`${msg.author.tag}: ${reason ? `: ${reason}` : ''}`) + .catch(err => { + msg.reply('There was an error.'); console.error(err.stack); + }); msg.channel.send(`Alright, I kicked **${member.user.tag}**${(reason ? ` for the reason **${reason}**.` : '.')}`); }; exports.checkPermission = (bot, member) => { - if (!member.hasPermission('KICK_MEMBERS')) return 'You don\'t have permission to kick members.'; + if (!member.hasPermission('KICK_MEMBERS')) { + return 'You don\'t have permission to kick members.'; + } return true; -} +}; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'kick', description: 'Kick a user out of the server.', - usage: '@user <...reason>', + usage: '@user <...reason>' }; diff --git a/commands/Moderation/lswarns.js b/commands/Moderation/lswarns.js index 732184d..7b39d12 100644 --- a/commands/Moderation/lswarns.js +++ b/commands/Moderation/lswarns.js @@ -9,24 +9,26 @@ exports.run = async (bot, msg) => { const db = require('quick.db'); - const { RichEmbed } = require('discord.js'); + const {RichEmbed} = require('discord.js'); const warns = await db.fetch(`warns_${msg.guild.id}_${msg.author.id}`); - if (!warns) return await msg.reply('You don\'t have any warnings in this server.'); + if (!warns) { + return msg.reply('You don\'t have any warnings in this server.'); + } const embed = new RichEmbed() .setTitle('Warns'); for (let i = 0; i < warns.count; i++) { - embed.addField('Warning #' + i + 1, warns.reasons[i]); + embed.addField(`Warning #${ i }${1}`, warns.reasons[i]); } - msg.channel.send({ embed }); + msg.channel.send({embed}); }; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'lswarns', - description: 'Shows all the warnings a user has.', + description: 'Shows all the warnings a user has.' }; diff --git a/commands/Moderation/purge.js b/commands/Moderation/purge.js index f244960..073d4bc 100644 --- a/commands/Moderation/purge.js +++ b/commands/Moderation/purge.js @@ -8,17 +8,25 @@ * *************************************/ exports.run = async (bot, msg, args) => { - if (!msg.guild.member(bot.user).hasPermission('MANAGE_MESSAGES')) return msg.reply('I don\'t have permission to manage messages.'); + if (!msg.guild.member(bot.user).hasPermission('MANAGE_MESSAGES')) { + return msg.reply('I don\'t have permission to manage messages.'); + } const user = msg.mentions.users.first(); const amount = parseInt(args[0]) ? parseInt(args[0]) : parseInt(args[1]); - if (!amount) return msg.reply('How many message shall I delete?'); - if (!amount && !user) return msg.reply('Tell me the user and amount or the just the amount of messages to purge.'); - if (amount > 100 || amount < 3) return msg.reply('Choose an amount less than 98 and greater than 1'); + if (!amount) { + return msg.reply('How many message shall I delete?'); + } + if (!amount && !user) { + return msg.reply('Tell me the user and amount or the just the amount of messages to purge.'); + } + if (amount > 100 || amount < 3) { + return msg.reply('Choose an amount less than 98 and greater than 1'); + } msg.delete(); - let msgs = await msg.channel.fetchMessages({ limit: amount }); + let msgs = await msg.channel.fetchMessages({limit: amount}); if (user) { const filterBy = user ? user.id : bot.user.id; msgs = msgs.filter(m => m.author.id === filterBy).array().slice(0, amount); @@ -27,17 +35,19 @@ exports.run = async (bot, msg, args) => { }; exports.checkPermission = (bot, member) => { - if (!member.hasPermission('MANAGE_MESSAGES')) return 'You don\'t have permission to manage messages.'; + if (!member.hasPermission('MANAGE_MESSAGES')) { + return 'You don\'t have permission to manage messages.'; + } return true; -} +}; exports.conf = { aliases: ['prune', 'rm'], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'purge', description: 'Get rid of messages quickly.', - usage: '@user <messages>', + usage: '@user <messages>' }; diff --git a/commands/Moderation/setLogs.js b/commands/Moderation/setLogs.js index e951c45..1eed5e6 100644 --- a/commands/Moderation/setLogs.js +++ b/commands/Moderation/setLogs.js @@ -7,24 +7,26 @@ * * *************************************/ -exports.run = async (bot, msg, args) => { +exports.run = (bot, msg, args) => { bot.plugins.settings.setStr('logs', args[0], msg.guild.id); - msg.reply('Alright, I have set the log channel to ' + args[0]); + msg.reply(`Alright, I have set the log channel to ${args[0]}`); }; exports.checkPermission = (bot, member) => { - if (!member.hasPermission('MANAGE_MESSAGES')) return 'You don\'t have permission to manage messages.'; + if (!member.hasPermission('MANAGE_MESSAGES')) { + return 'You don\'t have permission to manage messages.'; + } return true; -} +}; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'setLogs', description: 'Set\'s the Log Channel.', - usage: '<channelID>', + usage: '<channelID>' }; diff --git a/commands/Moderation/setSuggestions.js b/commands/Moderation/setSuggestions.js index ff5691e..258f202 100644 --- a/commands/Moderation/setSuggestions.js +++ b/commands/Moderation/setSuggestions.js @@ -7,24 +7,26 @@ * * *************************************/ -exports.run = async (bot, msg, args) => { +exports.run = (bot, msg, args) => { bot.plugins.settings.setStr('suggestions', args[0], msg.guild.id); - msg.reply('Alright, I have set the suggestions channel to ' + args[0]); + msg.reply(`Alright, I have set the suggestions channel to ${args[0]}`); }; exports.checkPermission = (bot, member) => { - if (!member.hasPermission('MANAGE_MESSAGES')) return 'You don\'t have permission to manage messages.'; + if (!member.hasPermission('MANAGE_MESSAGES')) { + return 'You don\'t have permission to manage messages.'; + } return true; -} +}; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'setSuggestions', description: 'Set\'s the Suggestions Channel.', - usage: '<channelID>', + usage: '<channelID>' }; diff --git a/commands/Moderation/softban.js b/commands/Moderation/softban.js index 7c5119b..3bbab28 100644 --- a/commands/Moderation/softban.js +++ b/commands/Moderation/softban.js @@ -8,27 +8,30 @@ * *************************************/ exports.run = async (bot, msg, args) => { - if (!msg.guild.member(bot.user).hasPermission('BAN_MEMBERS')) return msg.reply('I don\'t have permission to ban members.'); + if (!msg.guild.member(bot.user).hasPermission('BAN_MEMBERS')) { + return msg.reply('I don\'t have permission to ban members.'); + } const member = msg.mentions.members.first(); - if (!member) return await msg.reply('Who am I gonna softban?'); + if (!member) { + return msg.reply('Who am I gonna softban?'); + } const reason = args.join(' ').slice(3 + member.user.id.length); + try { + await member.ban({days: 7, reason: `${msg.author.tag }: ${ reason ? reason : ''}`}); + msg.channel.send(`Alright, I softbanned **${member.user.tag}**${(reason ? ` for the reason **${reason}**.` : '.')}`); + } catch(err) { + msg.reply('There was an error.'); + return console.error(err.stack); + } + try{ + await msg.guild.unban(member.user.id); + } catch(err) { + msg.reply('There was an error.'); + return console.error(err.stack); + } - await member.ban({ days: 7, reason: msg.author.tag + ': ' + (reason ? reason : '') }) - .catch(err => { - msg.reply('There was an error.'); - return console.error(err.stack); - }) - .then(() => { - msg.channel.send(`Alright, I softbanned **${member.user.tag}**${(reason ? ` for the reason **${reason}**.` : '.')}`); - }); - await msg.guild.unban(member.user.id) - .catch(err => { - msg.reply('There was an error.'); - return console.error(err.stack); - }); - - const { RichEmbed } = require('discord.js'); + const {RichEmbed} = require('discord.js'); try { const embed = new RichEmbed() .setColor(0x00ae86) @@ -40,26 +43,27 @@ exports.run = async (bot, msg, args) => { .setTimestamp() .setFooter(`${msg.author.tag} softbanned ${member.user.tag}`, msg.author.avatarURL); const logChannel = await bot.plugins.settings.getStr('logs', msg.guild.id); - msg.guild.channels.find('id', logChannel).send({ embed }); - } - catch (err) { + msg.guild.channels.find('id', logChannel).send({embed}); + } catch (err) { console.error(err.stack); } }; exports.checkPermission = (bot, member) => { - if (!member.hasPermission('BAN_MEMBERS')) return 'You don\'t have permission to ban members.'; + if (!member.hasPermission('BAN_MEMBERS')) { + return 'You don\'t have permission to ban members.'; + } return true; -} +}; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'softban', description: 'Kick the user and delete their messages.', - usage: '@user <...reason>', + usage: '@user <...reason>' }; diff --git a/commands/Moderation/timeout.js b/commands/Moderation/timeout.js index d8722a8..84020cd 100644 --- a/commands/Moderation/timeout.js +++ b/commands/Moderation/timeout.js @@ -8,17 +8,25 @@ * *************************************/ exports.run = async (bot, msg) => { - if (msg.guild.id != '417088992329334792') return msg.reply ('This is a PokeWorld exclusive command. Sorry!'); + if (msg.guild.id != '417088992329334792') { + return msg.reply('This is a PokeWorld exclusive command. Sorry!'); + } - if (!msg.member.hasPermission('BAN_MEMBERS')) return msg.reply('You don\'t have permission to put members in time-out..'); - if (!msg.guild.member(bot.user).hasPermission('MANAGE_ROLES')) return msg.reply('I cannot put anyone in time-out.'); + if (!msg.member.hasPermission('BAN_MEMBERS')) { + return msg.reply('You don\'t have permission to put members in time-out..'); + } + if (!msg.guild.member(bot.user).hasPermission('MANAGE_ROLES')) { + return msg.reply('I cannot put anyone in time-out.'); + } const member = msg.mentions.members.first(); - if (!member) return await msg.reply('Who do I put in time-out?'); + if (!member) { + return msg.reply('Who do I put in time-out?'); + } member.addRole(msg.guild.roles.find('name', 'Timeout')); - const { RichEmbed } = require('discord.js'); + const {RichEmbed} = require('discord.js'); try { const embed = new RichEmbed() .setColor(0x00ae86) @@ -29,25 +37,26 @@ exports.run = async (bot, msg) => { .setTimestamp() .setFooter(`${msg.author.tag} put ${member.user.tag} in time-out.`, msg.author.avatarURL); const logChannel = await bot.plugins.settings.getStr('logs', msg.guild.id); - msg.guild.channels.find('id', logChannel).send({ embed }); - } - catch (err) { + msg.guild.channels.find('id', logChannel).send({embed}); + } catch (err) { console.error(err.stack); } }; exports.checkPermission = (bot, member) => { - if (!member.hasPermission('BAN_MEMBERS')) return 'You don\'t have permission to put members in time-out..'; + if (!member.hasPermission('BAN_MEMBERS')) { + return 'You don\'t have permission to put members in time-out..'; + } return true; -} +}; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'timeout', description: 'Put a user in time-out', - usage: '@user', + usage: '@user' }; diff --git a/commands/Moderation/warn.js b/commands/Moderation/warn.js index b8548a3..5dcd5ef 100644 --- a/commands/Moderation/warn.js +++ b/commands/Moderation/warn.js @@ -21,13 +21,12 @@ exports.run = async (bot, msg, args) => { if (warns) { const reasons = warns.reasons; reasons.push(warnReason); - await db.set(`warns_${msg.guild.id}_${victim.user.id}`, { count : warns.count + 1, reasons : reasons }); - } - else { - await db.set(`warns_${msg.guild.id}_${victim.user.id}`, { count : 1, reasons : [warnReason]}); + await db.set(`warns_${msg.guild.id}_${victim.user.id}`, {count : warns.count + 1, reasons : reasons}); + } else { + await db.set(`warns_${msg.guild.id}_${victim.user.id}`, {count : 1, reasons : [warnReason]}); } - const { RichEmbed } = require('discord.js'); + const {RichEmbed} = require('discord.js'); const logChannel = await bot.plugins.settings.getStr('logs', msg.guild.id); bot.channels.find('id', logChannel).send( new RichEmbed() @@ -38,22 +37,24 @@ exports.run = async (bot, msg, args) => { .addField('ID', victim.id, true) .addField('Created Account', victim.user.createdAt, true) .setTimestamp() - .setFooter('Warned by: ' + msg.author.tag, msg.author.avatarURL) + .setFooter(`Warned by: ${msg.author.tag}`, msg.author.avatarURL) ); }; exports.checkPermission = (bot, member) => { - if (!member.hasPermission('MANAGE_MESSAGES')) return 'You don\'t have permission to warn.'; + if (!member.hasPermission('MANAGE_MESSAGES')) { + return 'You don\'t have permission to warn.'; + } return true; -} +}; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'warn', description: 'Logs a warning to the user.', - usage : '@user <reason>', + usage : '@user <reason>' }; diff --git a/commands/Owners Only/eval.js b/commands/Owners Only/eval.js index 5153b63..bd0528b 100644 --- a/commands/Owners Only/eval.js +++ b/commands/Owners Only/eval.js @@ -7,8 +7,8 @@ * * *************************************/ -exports.run = async (bot, msg, args) => { - const { RichEmbed } = require('discord.js'); +exports.run = (bot, msg, args) => { + const {RichEmbed} = require('discord.js'); const code = args.join(' '); let evaled; @@ -17,7 +17,7 @@ exports.run = async (bot, msg, args) => { try { remove = text => { if (typeof(text) === 'string') { - return text.replace(/`/g, '`' + String.fromCharCode(8203)).replace(/@/g, '@' + String.fromCharCode(8203)); + return text.replace(/`/g, `\`${String.fromCharCode(8203)}`).replace(/@/g, `@${ String.fromCharCode(8203)}`); } else { return text; } @@ -37,7 +37,7 @@ exports.run = async (bot, msg, args) => { .addField(':outbox_tray: Output:', `\`\`\`${err}\`\`\``) .setFooter('Eval', bot.user.avatarURL) .setColor('RED'); - return msg.channel.send({ embed }); + return msg.channel.send({embed}); } try { @@ -49,7 +49,7 @@ exports.run = async (bot, msg, args) => { .setFooter('Eval', bot.user.avatarURL) .setColor('GREEN'); - return msg.channel.send({ embed }); + return msg.channel.send({embed}); } catch (err) { const embed = new RichEmbed() .setAuthor('Eval Error') @@ -58,22 +58,24 @@ exports.run = async (bot, msg, args) => { .addField(':outbox_tray: Output:', `\`\`\`${err}\`\`\``) .setFooter('Eval', bot.user.avatarURL) .setColor('RED'); - return msg.channel.send({ embed }); + return msg.channel.send({embed}); } }; exports.checkPermission = (bot, member) => { - if (!['242775871059001344', '247221105515823104', '236279900728721409'].includes(member.id)) return false; + if (!['242775871059001344', '247221105515823104', '236279900728721409'].includes(member.id)) { + return false; + } return true; -} +}; exports.conf = { aliases: ['exec'], - guildOnly: false, + guildOnly: false }; exports.help = { name: 'eval', description: 'Evaluates Javascript Code', - usage: '<code>', + usage: '<code>' }; diff --git a/commands/Owners Only/leaveguild.js b/commands/Owners Only/leaveguild.js index f214b8b..3d8db42 100644 --- a/commands/Owners Only/leaveguild.js +++ b/commands/Owners Only/leaveguild.js @@ -1,27 +1,29 @@ /**************************************** - * + * * LeaveGuild: Plugin for PokeBot that leaves a guild * Copyright (C) 2018 TheEdge, jtsshieh, Alee * * Licensed under the Open Software License version 3.0 - * + * * *************************************/ -module.exports.run = async (bot, msg) => { - msg.channel.send('Alright, I\'m leaving the server now. Bye everyone!') - msg.guild.leave(); - }; +module.exports.run = (bot, msg) => { + msg.channel.send('Alright, I\'m leaving the server now. Bye everyone!'); + msg.guild.leave(); +}; - exports.checkPermission = (bot, member) => { - if (!['242775871059001344', '247221105515823104', '236279900728721409'].includes(member.id)) return false; - return true; +exports.checkPermission = (bot, member) => { + if (!['242775871059001344', '247221105515823104', '236279900728721409'].includes(member.id)) { + return false; } + return true; +}; - exports.conf = { - aliases: [], - guildOnly: true, - }; - exports.help = { - name: 'leaveguild', - description: 'Makes the bot leave the server', - }; +exports.conf = { + aliases: [], + guildOnly: true +}; +exports.help = { + name: 'leaveguild', + description: 'Makes the bot leave the server' +}; diff --git a/commands/Owners Only/modifycredits.js b/commands/Owners Only/modifycredits.js index 6ec7506..4ab5e00 100644 --- a/commands/Owners Only/modifycredits.js +++ b/commands/Owners Only/modifycredits.js @@ -7,7 +7,7 @@ * * *************************************/ -exports.run = async (bot, msg) => { +exports.run = (bot, msg) => { let user; if (!msg.mentions.users.first()) { user = msg.author; @@ -23,17 +23,19 @@ exports.run = async (bot, msg) => { }; exports.checkPermission = (bot, member) => { - if (!['242775871059001344', '247221105515823104', '236279900728721409'].includes(member.id)) return false; + if (!['242775871059001344', '247221105515823104', '236279900728721409'].includes(member.id)) { + return false; + } return true; -} +}; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'modifycredits', description: 'Modifies the credits of a user', - usage: '@user <credits>', + usage: '@user <credits>' }; diff --git a/commands/Owners Only/poweroff.js b/commands/Owners Only/poweroff.js index 3d2cbdd..bfd5f86 100644 --- a/commands/Owners Only/poweroff.js +++ b/commands/Owners Only/poweroff.js @@ -9,22 +9,24 @@ exports.run = async (bot, msg) => { await msg.reply(':warning: Pokebot is now powering off!'); - await bot.user.setStatus('invisible') + await bot.user.setStatus('invisible'); console.log('Pokebot is now powering off...'); process.exit(0); }; exports.checkPermission = (bot, member) => { - if (!['242775871059001344', '247221105515823104', '236279900728721409'].includes(member.id)) return false; + if (!['242775871059001344', '247221105515823104', '236279900728721409'].includes(member.id)) { + return false; + } return true; -} +}; exports.conf = { aliases: ['reboot', 'restart'], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'poweroff', - description: 'Powers off the bot.', + description: 'Powers off the bot.' }; diff --git a/commands/Owners Only/say.js b/commands/Owners Only/say.js index ace2874..ad1a9bd 100644 --- a/commands/Owners Only/say.js +++ b/commands/Owners Only/say.js @@ -7,23 +7,25 @@ * * *************************************/ -exports.run = async (bot, msg, args) => { +exports.run = (bot, msg, args) => { msg.channel.send(args.join(' ')); msg.delete(); }; exports.checkPermission = (bot, member) => { - if (!['242775871059001344', '247221105515823104', '236279900728721409'].includes(member.id)) return false; + if (!['242775871059001344', '247221105515823104', '236279900728721409'].includes(member.id)) { + return false; + } return true; -} +}; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'say', description: 'Control on what the bot says.', - usage: '<...text>', + usage: '<...text>' }; diff --git a/commands/Owners Only/testingcredits.js b/commands/Owners Only/testingcredits.js index 85cc859..87c1924 100644 --- a/commands/Owners Only/testingcredits.js +++ b/commands/Owners Only/testingcredits.js @@ -7,7 +7,7 @@ * * *************************************/ -exports.run = async (bot, msg) => { +exports.run = (bot, msg) => { let user; if (!msg.mentions.members.first()) { user = msg.author; @@ -21,17 +21,19 @@ exports.run = async (bot, msg) => { }; exports.checkPermission = (bot, member) => { - if (!['242775871059001344', '247221105515823104', '236279900728721409'].includes(member.id)) return false; + if (!['242775871059001344', '247221105515823104', '236279900728721409'].includes(member.id)) { + return false; + } return true; -} +}; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'testingcredits', description: 'Modifies the credits of a user', - usage: '@user <credits>', + usage: '@user <credits>' }; 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' }; diff --git a/commands/Utility/character.js b/commands/Utility/character.js index 56d9bfb..2ed549e 100644 --- a/commands/Utility/character.js +++ b/commands/Utility/character.js @@ -8,14 +8,16 @@ * *************************************/ exports.run = (bot, msg, args) => { - const { RichEmbed } = require('discord.js'); + const {RichEmbed} = require('discord.js'); const embed = new RichEmbed() .setTitle('***Character Analysis***') .setDescription('Find out the decimal and hexadecimal of each and every character in a string.') .setColor('#000'); const str = args.join(' '); - if (str.length > 50) return msg.reply('The limit is 50 for how many characters you can input'); + if (str.length > 50) { + return msg.reply('The limit is 50 for how many characters you can input'); + } const array = str.split(''); let decimal = ''; @@ -29,22 +31,22 @@ exports.run = (bot, msg, args) => { const code = str.charCodeAt(x); let codeHex = code.toString(16).toUpperCase(); while (codeHex.length < 4) { - codeHex = '0' + codeHex; + codeHex = `0${codeHex}`; } hexadecimal += `\`\\u${codeHex}\`\t${array[x]}\n`; } embed.addField('*Hexadecimal*', hexadecimal, true); - msg.channel.send({ embed }); + msg.channel.send({embed}); }; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'character', description: 'Gets the decimal and hexadecimal of (a) character(s)', - usage: '<...characters>', + usage: '<...characters>' }; diff --git a/commands/Utility/hinfo.js b/commands/Utility/hinfo.js index 982a3bf..edffe5b 100644 --- a/commands/Utility/hinfo.js +++ b/commands/Utility/hinfo.js @@ -8,24 +8,24 @@ * *************************************/ exports.run = (bot, msg) => { - const { RichEmbed } = require('discord.js'); - const os = require('os'); - const embed = new RichEmbed() - .setTitle('Information on PokeBot\'s Host') - .addField('OS Hostname: ', os.hostname() , true) - .addField('NodeJS Version: ', process.versions.node , true) - .addField('OS Platform: ', os.platform() , true) - .addField('OS Version: ', os.release() , true) - .setColor('#000000'); - msg.channel.send({embed}); + const {RichEmbed} = require('discord.js'); + const os = require('os'); + const embed = new RichEmbed() + .setTitle('Information on PokeBot\'s Host') + .addField('OS Hostname: ', os.hostname(), true) + .addField('NodeJS Version: ', process.versions.node, true) + .addField('OS Platform: ', os.platform(), true) + .addField('OS Version: ', os.release(), true) + .setColor('#000000'); + msg.channel.send({embed}); }; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'hinfo', - description: 'Gives host information to user.', + description: 'Gives host information to user.' }; diff --git a/commands/Utility/invite.js b/commands/Utility/invite.js index 933e9ba..f029fcb 100644 --- a/commands/Utility/invite.js +++ b/commands/Utility/invite.js @@ -13,10 +13,10 @@ exports.run = (bot, msg) => { exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'invite', - description: 'Gives the user a link to invite the bot.', + description: 'Gives the user a link to invite the bot.' }; diff --git a/commands/Utility/nick.js b/commands/Utility/nick.js index bec9578..f02af0f 100644 --- a/commands/Utility/nick.js +++ b/commands/Utility/nick.js @@ -8,14 +8,18 @@ * *************************************/ exports.run = async (bot, msg, args) => { - const { RichEmbed } = require('discord.js'); + const {RichEmbed} = require('discord.js'); msg.member.setNickname(args.join(' '), 'Requested by bot'); - msg.channel.send('Changed nickname to: ' + args.join(' ')); + msg.channel.send(`Changed nickname to: ${args.join(' ')}`); const logChannel = await bot.plugins.settings.getStr('logs', msg.member.guild.id); - if (!logChannel) return; + if (!logChannel) { + return; + } const channelObj = bot.channels.find('id', logChannel); - if (!channelObj) return; + if (!channelObj) { + return; + } channelObj.send( new RichEmbed() .setColor(0x00ae86) @@ -25,16 +29,15 @@ exports.run = async (bot, msg, args) => { .setTimestamp() .setFooter('PokeBot v1.0') ); - }; exports.conf = { aliases: ['nickname'], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'nick', description: 'Change your nickname.', - usage: '<...new nick>', + usage: '<...new nick>' }; diff --git a/commands/Utility/suggest.js b/commands/Utility/suggest.js index f1b4206..b935977 100644 --- a/commands/Utility/suggest.js +++ b/commands/Utility/suggest.js @@ -8,11 +8,11 @@ * *************************************/ exports.run = async (bot, msg, args) => { - const { RichEmbed } = require('discord.js'); + const {RichEmbed} = require('discord.js'); const suggestionChannel = await bot.plugins.settings.getStr('suggestions', msg.member.guild.id); bot.channels.find('id', suggestionChannel).send( new RichEmbed() - .setColor (0x00ae86) + .setColor(0x00ae86) .setTitle('Suggestion') .setDescription('This is a suggestion from a community member for something relating to the server. Please rate it based on your opinion, and a staff member will decide what to do with the suggestion.') .addField('Suggestion Contents', args.join(' ')) @@ -24,11 +24,11 @@ exports.run = async (bot, msg, args) => { exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'suggest', description: 'Suggest a feature for the bot or the server.', - usage: '<...suggestion>', + usage: '<...suggestion>' }; diff --git a/commands/Utility/uptime.js b/commands/Utility/uptime.js index 8492df2..dd072a4 100644 --- a/commands/Utility/uptime.js +++ b/commands/Utility/uptime.js @@ -15,22 +15,28 @@ exports.run = (bot, msg, args) => { let hours = 0; while (uptimeMinutes >= 60) { hours++; - uptimeMinutes = uptimeMinutes - 60; + uptimeMinutes -= 60; } const uptimeSeconds = minutes % 60; - if (args[0] === 'ms') return msg.channel.send(bot.uptime + ' ms.'); - if (args[0] === 's') return msg.channel.send(uptimeSeconds + ' seconds.'); - if (args[0] === 'min') return msg.channel.send(Math.floor(uptime / 60) + ' minutes ' + uptimeSeconds + ' seconds.'); - msg.channel.send(':clock3: Pokebot has been up for ' + hours + ' hours, ' + uptimeMinutes + ' minutes, and ' + uptimeSeconds + ' seconds.'); + if (args[0] === 'ms') { + return msg.channel.send(`${bot.uptime } ms.`); + } + if (args[0] === 's') { + return msg.channel.send(`${uptimeSeconds } seconds.`); + } + if (args[0] === 'min') { + return msg.channel.send(`${Math.floor(uptime / 60) } minutes ${ uptimeSeconds } seconds.`); + } + msg.channel.send(`:clock3: Pokebot has been up for ${ hours } hours, ${ uptimeMinutes } minutes, and ${ uptimeSeconds } seconds.`); }; exports.conf = { aliases: [], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'uptime', - description: 'Get the uptime of the bot.', + description: 'Get the uptime of the bot.' }; diff --git a/commands/Utility/userinfo.js b/commands/Utility/userinfo.js index 80844e1..e57351d 100644 --- a/commands/Utility/userinfo.js +++ b/commands/Utility/userinfo.js @@ -7,8 +7,8 @@ * * *************************************/ -exports.run = async (bot, msg) => { - const { RichEmbed } = require('discord.js'); +exports.run = (bot, msg) => { + const {RichEmbed} = require('discord.js'); let user; if (!msg.mentions.members.first()) { user = msg.member; @@ -22,18 +22,18 @@ exports.run = async (bot, msg) => { .addField('User ID', user.id) .addField('Account Creation Date', user.user.createdAt) .addField('Join Guild Date', user.joinedAt) - .addField('Names', 'Display Name: ' + user.displayName + `\nUsername: ${user.user.tag}`) + .addField('Names', `Display Name: ${user.displayName }\nUsername: ${user.user.tag}`) .setFooter('PokeBot v1.0') ); }; exports.conf = { aliases: ['uinfo', 'userinformation'], - guildOnly: true, + guildOnly: true }; exports.help = { name: 'userinfo', description: 'Shows information about the mentioned user', - usage: '@user', + usage: '@user' }; |
