es-lint settings added + linted all files

This commit is contained in:
Justin 2019-11-02 11:02:19 -04:00
parent 106530d5dc
commit 7031fa12ba
58 changed files with 1659 additions and 555 deletions

150
bot.js
View file

@ -4,12 +4,11 @@ const config = require('./config.json');
const fs = require('fs');
const readline = require('readline');
const DBL = require('dblapi.js');
if (typeof config.dbltoken == 'undefined') {
console.log("Skipping DBL...");
if (typeof config.dbltoken === 'undefined') {
console.log('Skipping DBL...');
} else {
bot.dbl = new DBL(config.dbltoken, bot);
console.log("DBL has been found...");
bot.dbl = new DBL(config.dbltoken, bot);
console.log('DBL has been found...');
}
@ -28,21 +27,21 @@ bot.plugins = {
settings : require('./plugins/settings.js'),
whitelist: require('./plugins/whitelist.js'),
gyms : require('./plugins/gyms.js')};
cmdLoader();
bot.Raven = require('raven');
bot.Raven.config(config.sentry).install();
bot.gyms = new Discord.Collection();
async function cmdLoader() {
const categories = await fs.readdirSync('./commands');
function cmdLoader() {
const categories = fs.readdirSync('./commands');
console.log(`Loading ${categories.length} categories(s) into memory\n`);
categories.forEach(x => {
loadGroup(x);
});
}
async function loadGroup(name) {
const files = await fs.readdirSync(`./commands/${name}`);
function loadGroup(name) {
const files = fs.readdirSync(`./commands/${name}`);
console.log(`Loading the category '${name}' into memory with a total of ${files.length} command(s)`);
@ -59,7 +58,7 @@ async function loadGroup(name) {
console.log(`The category ${name} has been loaded.\n`);
}
async function loadCmd(category, cmd) {
function loadCmd(category, cmd) {
try {
console.log(`Loading the Command ${cmd.split('.')[0]}`);
const command = require(`./commands/${category}/${cmd}`);
@ -68,8 +67,7 @@ async function loadCmd(category, cmd) {
console.log(`Loading the alias ${alias} for the command ${command.help.name}`);
bot.aliases.get(category).set(alias, command.help.name);
});
}
catch (err) {
} catch (err) {
console.log(`An error has occured trying to load the command '${cmd.split('.')[0]}'`);
console.log(err.stack);
bot.Raven.captureException(err);
@ -78,7 +76,9 @@ async function loadCmd(category, cmd) {
fs.readdir('./events', (err, files) => {
if (err) console.error(err);
if (err) {
console.error(err);
}
console.log(`Attempting to load a total of ${files.length} events into the memory.`);
files.forEach(file => {
try {
@ -87,8 +87,7 @@ fs.readdir('./events', (err, files) => {
console.log(`Attempting to load the event "${eventName}".`);
bot.on(eventName, event.bind(null, bot));
delete require.cache[require.resolve(`./events/${file}`)];
}
catch (err) {
} catch (err) {
console.log('An error has occured trying to load a event. Here is the error.');
console.log(err.stack);
bot.Raven.captureException(err);
@ -101,69 +100,69 @@ fs.readdir('./events', (err, files) => {
rl.on('line', function(cmd) {
const args = cmd.split(' ');
switch (args[0]) {
case 'guilds':
if (bot.guilds.size === 0) {
console.log(('[!] No guilds found.'));
} else {
console.log('[i] Here\'s the servers that PokeBot is connected to:');
for (const [id, guild] of bot.guilds) {
console.log(` Guild Name: ${guild.name} - ID: ${guild.id}`);
}
case 'guilds':
if (bot.guilds.size === 0) {
console.log(('[!] No guilds found.'));
} else {
console.log('[i] Here\'s the servers that PokeBot is connected to:');
for (const guild of bot.guilds) {
console.log(` Guild Name: ${guild[1].name} - ID: ${guild[1].id}`);
}
break;
case 'channels':
if (!args[1]) {
console.log('[!] Please insert the guild\'s ID.');
} else {
var guild = bot.guilds.get(args[1]);
console.log('[i] Here\'s the channels that this guild have:');
for ([id, channel, guild] of guild && bot.channels) {
console.log(` Channel: #${channel.name} - ID: ${channel.id}`);
}
}
break;
case 'channels':
if (!args[1]) {
console.log('[!] Please insert the guild\'s ID.');
} else {
const guild = bot.guilds.get(args[1]);
console.log('[i] Here\'s the channels that this guild have:');
for (const channel of guild && bot.channels) {
console.log(` Channel: #${channel[1].name} - ID: ${channel[1].id}`);
}
break;
case 'leave':
if (!args[1]) {
console.log('[!] Please insert the guild\'s ID.');
} else {
var guild = bot.guilds.get(args[1]);
guild.leave();
}
break;
case 'leave':
if (!args[1]) {
console.log('[!] Please insert the guild\'s ID.');
} else {
bot.guilds.get(args[1]).leave();
}
break;
case 'broadcast':
if (!args[1]) {
console.log('[!] Please insert the guild\'s ID.');
} else {
const broadcast = args.join(' ').slice(48);
let guild = null;
guild = bot.guilds.get(args[1]);
let channel = null;
channel = guild.channels.get(args[2]);
if (channel != null) {
channel.send(broadcast);
}
break;
case 'broadcast':
if (!args[1]) {
console.log('[!] Please insert the guild\'s ID.');
} else {
const broadcast = args.join(' ').slice(48);
var guild = null;
guild = bot.guilds.get(args[1]);
var channel = null;
channel = guild.channels.get(args[2]);
if (channel != null) {
channel.send(broadcast);
}
if (channel = null) {
console.log ('Usage: broadcast [guildID] [channelID]');
}
if (channel == null) {
console.log('Usage: broadcast [guildID] [channelID]');
}
break;
case 'exit':
console.log('[i] PokeBot will now exit!');
bot.user.setStatus('invisible');
process.exit(0);
break;
case 'help':
var msg = ('PokeBot Console Help\n\n');
msg += ('guilds - Shows all guilds that PokeBot\'s on.\n');
msg += ('channels - Shows all the channels that the guilds have.\n');
msg += ('leave - Leaves a guild.\n');
msg += ('broadcast - Broadcasts a message to a server.\n');
msg += ('help - Shows this command.\n');
msg += ('exit - Exits PokeBot.\n');
console.log(msg);
break;
default:
console.log('Unknown Command type \'help\' to list the commands...');
}
break;
case 'exit':
console.log('[i] PokeBot will now exit!');
bot.user.setStatus('invisible');
process.exit(0);
break;
case 'help': {
let msg = ('PokeBot Console Help\n\n');
msg += ('guilds - Shows all guilds that PokeBot\'s on.\n');
msg += ('channels - Shows all the channels that the guilds have.\n');
msg += ('leave - Leaves a guild.\n');
msg += ('broadcast - Broadcasts a message to a server.\n');
msg += ('help - Shows this command.\n');
msg += ('exit - Exits PokeBot.\n');
console.log(msg);
break;
}
default:
console.log('Unknown Command type \'help\' to list the commands...');
}
rl.prompt();
});
@ -172,6 +171,7 @@ process.on('unhandledRejection', (err) => {
console.error(err.stack);
bot.Raven.captureException(err);
});
cmdLoader();
bot.login(config.token).then(() => {
rl.prompt();
});

View file

@ -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>'
};

View file

@ -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!'
};

View file

@ -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.'
};

View file

@ -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.'
};

View file

@ -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!'
};

View file

@ -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.'
};

View file

@ -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.'
};

View file

@ -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.'
};

View file

@ -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.'
};

View file

@ -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.'
};

View file

@ -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.'
};

View file

@ -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.'
};

View file

@ -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!'
};

View file

@ -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}**.` : '.')}`);
const { RichEmbed } = require('discord.js');
} catch(err) {
msg.reply('There was an error.'); return console.error(err.stack);
}
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>'
};

View file

@ -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'
};

View file

@ -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'
};

View file

@ -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>'
};

View file

@ -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.'
};

View file

@ -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>'
};

View file

@ -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>'
};

View file

@ -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>'
};

View file

@ -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>'
};

View file

@ -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'
};

View file

@ -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>'
};

View file

@ -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>'
};

View file

@ -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'
};

View file

@ -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>'
};

View file

@ -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.'
};

View file

@ -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>'
};

View file

@ -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>'
};

View file

@ -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.'
};

View file

@ -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.'
};

View file

@ -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.'
};

View file

@ -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>'
};

View file

@ -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.'
};

View file

@ -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>'
};

View file

@ -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'
};

View file

@ -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>'
};

View file

@ -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.'
};

View file

@ -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.'
};

View file

@ -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>'
};

View file

@ -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>'
};

View file

@ -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.'
};

View file

@ -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'
};

View file

@ -8,11 +8,15 @@
* *************************************/
module.exports = async (bot, member) => {
const { RichEmbed } = require('discord.js');
const {RichEmbed} = require('discord.js');
const logChannel = await bot.plugins.settings.getStr('logs', 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)
@ -24,14 +28,16 @@ module.exports = async (bot, member) => {
.setFooter(member.user.tag, member.user.avatarURL)
);
if (member.guild.id != '417088992329334792') return;
if (member.guild.id != '417088992329334792') {
return;
}
const botCount = member.guild.members.filter(x => x.user.bot).size;
bot.channels.get('635835776613220353').setName('User Count: ' + member.guild.memberCount);
bot.channels.get('635835832913231872').setName('Member Count: ' + (member.guild.memberCount - botCount));
bot.channels.get('635835875065987073').setName('Bot Count: ' + botCount);
bot.channels.get('635835776613220353').setName(`User Count: ${member.guild.memberCount}`);
bot.channels.get('635835832913231872').setName(`Member Count: ${member.guild.memberCount - botCount}`);
bot.channels.get('635835875065987073').setName(`Bot Count: ${botCount}`);
bot.channels.get('417100669980508160').send(`Welcome to the server **${member.user.tag}**! Make sure to read the rules! We now have ${member.guild.memberCount} members.`);
bot.channels.get('417088992329334794').send('Welcome to the server <@' + member.id + '>. Be sure to join a team: `p:join <flare, skull>`. Also, make sure to read our introduction: `p:start`.');
bot.channels.get('417088992329334794').send(`Welcome to the server <@${member.id }>. Be sure to join a team: \`p:join <flare, skull>\`. Also, make sure to read our introduction: \`p:start\`.`);
const role = member.guild.roles.find('name', 'Trainers');
member.addRole(role);
};

View file

@ -8,11 +8,15 @@
* *************************************/
module.exports = async (bot, member) => {
const { RichEmbed } = require('discord.js');
const {RichEmbed} = require('discord.js');
const logChannel = await bot.plugins.settings.getStr('logs', 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)
@ -24,10 +28,12 @@ module.exports = async (bot, member) => {
.setTimestamp()
.setFooter(member.user.tag, member.user.avatarURL)
);
if (member.guild.id != '417088992329334792') return;
if (member.guild.id != '417088992329334792') {
return;
}
const botCount = member.guild.members.filter(x => x.user.bot).size;
bot.channels.get('635835776613220353').setName('User Count: ' + member.guild.memberCount);
bot.channels.get('635835832913231872').setName('Member Count: ' + (member.guild.memberCount - botCount));
bot.channels.get('635835875065987073').setName('Bot Count: ' + botCount);
bot.channels.get('635835776613220353').setName(`User Count: ${member.guild.memberCount}`);
bot.channels.get('635835832913231872').setName(`Member Count: ${member.guild.memberCount - botCount}`);
bot.channels.get('635835875065987073').setName(`Bot Count: ${botCount}`);
bot.channels.get('417100669980508160').send(`**${member.user.tag}** just left. We now have ${member.guild.memberCount} members left. Aww man...`);
};

View file

@ -26,23 +26,35 @@ module.exports = (bot, msg) => {
};
function parseCommand(bot, msg) {
let category;
const settings = require("../assets/settings.json");
const prefix = settings.prefix;
if (msg.author.bot) return;
if (msg.author.bot) {
return;
}
const settings = require('../assets/settings.json');
const prefix = settings.prefix;
if (!msg.content.startsWith(prefix)) {
return;
}
if (!msg.content.startsWith(prefix)) return;
const args = msg.content.slice(prefix.length).trim().split(/ +/g);
let category;
const command = args.shift();
let cmd;
Array.from(bot.categories.keys()).forEach(i => {
const cmds = bot.categories.get(i);
if (cmds.includes(command)) category = i;
if (bot.aliases.get(i).has(command)) category = i;
if (cmds.includes(command)) {
category = i;
}
if (bot.aliases.get(i).has(command)) {
category = i;
}
});
if (!category) return;
if (!category) {
return;
}
if (bot.commands.get(category).has(command)) {
cmd = bot.commands.get(category).get(command);
} else if (bot.aliases.get(category).has(command)) {
@ -54,18 +66,18 @@ function parseCommand(bot, msg) {
return msg.reply('This command can only be ran in a guild.');
}
if (cmd.checkPermission != null) {
let result = cmd.checkPermission(bot, msg.member)
if (result != true)
{
if (result == false) return msg.reply('You are not authorized to run this command.');
const result = cmd.checkPermission(bot, msg.member);
if (result != true) {
if (result == false) {
return msg.reply('You are not authorized to run this command.');
}
return msg.reply(result);
}
}
try {
console.log(`${msg.author.tag} ran the command '${cmd.help.name}' in the guild '${msg.member.guild.name}'`);
cmd.run(bot, msg, args);
}
catch (e) {
} catch (e) {
console.error(e.stack);
bot.Raven.captureException(e);
msg.channel.send('There was an error trying to process your command. Don\'t worry because this issue is being looked into');

View file

@ -8,8 +8,10 @@
* *************************************/
module.exports = async (bot, msg) => {
const { RichEmbed } = require('discord.js');
if (!msg.content) return;
const {RichEmbed} = require('discord.js');
if (!msg.content) {
return;
}
try {
const embed = new RichEmbed()
.setColor(0x00ae86)
@ -19,12 +21,15 @@ module.exports = async (bot, msg) => {
.setTimestamp()
.setFooter(`Deleted message orginally created by: ${msg.author.tag}`, msg.author.avatarURL);
const logChannel = await bot.plugins.settings.getStr('logs', msg.guild.id);
if (!logChannel) return;
if (!logChannel) {
return;
}
const channelObj = bot.channels.find('id', logChannel);
if (!channelObj) return;
channelObj.send({ embed });
}
catch (err) {
if (!channelObj) {
return;
}
channelObj.send({embed});
} catch (err) {
console.error(err.stack);
}
};

View file

@ -8,7 +8,7 @@
* *************************************/
module.exports = async (bot, msgs) => {
const { RichEmbed } = require('discord.js');
const {RichEmbed} = require('discord.js');
try {
const embed = new RichEmbed()
.setColor(0x00ae86)
@ -17,12 +17,15 @@ module.exports = async (bot, msgs) => {
.setTimestamp()
.setFooter('Messages purged');
const logChannel = await bot.plugins.settings.getStr('logs', msgs.first().guild.id);
if (!logChannel) return;
if (!logChannel) {
return;
}
const channelObj = bot.channels.find('id', logChannel);
if (!channelObj) return;
channelObj.send({ embed });
}
catch (err) {
if (!channelObj) {
return;
}
channelObj.send({embed});
} catch (err) {
console.error(err.stack);
}
};

View file

@ -8,8 +8,10 @@
* *************************************/
module.exports = async (bot, oldMsg, newMsg) => {
const { RichEmbed } = require('discord.js');
if (oldMsg.content == newMsg.content) return;
const {RichEmbed} = require('discord.js');
if (oldMsg.content == newMsg.content) {
return;
}
try {
const embed = new RichEmbed()
.setColor(0x00ae86)
@ -20,12 +22,15 @@ module.exports = async (bot, oldMsg, newMsg) => {
.setTimestamp()
.setFooter(`Edited message originally created by: ${oldMsg.author.tag}`, oldMsg.author.avatarURL);
const logChannel = await bot.plugins.settings.getStr('logs', oldMsg.guild.id);
if (!logChannel) return;
if (!logChannel) {
return;
}
const channelObj = bot.channels.find('id', logChannel);
if (!channelObj) return;
channelObj.send({ embed });
}
catch (err) {
if (!channelObj) {
return;
}
channelObj.send({embed});
} catch (err) {
console.error(err.stack);
}
};

View file

@ -16,7 +16,7 @@ module.exports = (bot) => {
'Finding pokemon',
'Type p:help for help',
'Fighting AstralMod',
'Arrays start at 1',
'Arrays start at 1'
];
bot.user.setPresence({
@ -24,8 +24,8 @@ module.exports = (bot) => {
afk: false,
game: {
type: 0,
name: games[Math.floor(Math.random() * games.length)],
},
name: games[Math.floor(Math.random() * games.length)]
}
});
}, 200000);
};

913
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -16,5 +16,8 @@
"request": "^2.88.0",
"request-promise": "^4.2.4",
"snekfetch": "^4.0.0-rc.0"
},
"devDependencies": {
"eslint": "^6.6.0"
}
}

View file

@ -12,10 +12,9 @@ exports.get = async (userid) => {
const amount = await db.fetch(`money_${userid}`);
if (amount) {
return amount;
}
else {
} else {
await db.set(`money_${userid}`, 0);
return await db.fetch(`money_${userid}`);
return db.fetch(`money_${userid}`);
}
};
@ -23,8 +22,7 @@ exports.add = async (userid, money) => {
const amount = await db.fetch(`money_${userid}`);
if (amount) {
await db.set(`money_${userid}`, amount + money);
}
else {
} else {
await db.set(`money_${userid}`, money);
}
};
@ -33,8 +31,7 @@ exports.subtract = async (userid, money) => {
const amount = await db.fetch(`money_${userid}`);
if (amount) {
await db.set(`money_${userid}`, amount - money);
}
else {
} else {
await db.set(`money_${userid}`, 0 - money);
}
};

View file

@ -9,15 +9,23 @@
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;
if (member.roles.find('name', 'Skull')) {
team = 'Skull';
}
if (member.roles.find('name', 'Flare')) {
team = 'Flare';
}
return Boolean(team);
};
exports.getTeam = (member) => {
let team;
if (member.roles.find('name', 'Skull')) team = 'Skull';
if (member.roles.find('name', 'Flare')) team = 'Flare';
if (member.roles.find('name', 'Skull')) {
team = 'Skull';
}
if (member.roles.find('name', 'Flare')) {
team = 'Flare';
}
return team;
};
@ -26,7 +34,7 @@ exports.getOwnerId = (title) => {
};
exports.getGymString = (bot, member) => {
return 'Current Owner: ' + member.id + '/' + member.user.tag + '/' + bot.plugins.gyms.getTeam(member);
return `Current Owner: ${ member.id }/${ member.user.tag }/${ bot.plugins.gyms.getTeam(member)}`;
};
exports.isOwned = (title) => {

View file

@ -12,10 +12,9 @@ exports.getInt = async (key, guildID) => {
const value = await db.fetch(`settings_${guildID}_${key}`);
if (value) {
return value;
}
else {
} else {
await db.set(`settings_${guildID}_${key}`, 0);
return await db.fetch(`settings_${guildID}_${key}`);
return db.fetch(`settings_${guildID}_${key}`);
}
};
@ -23,10 +22,9 @@ exports.getStr = async (key, guildID) => {
const value = await db.fetch(`settings_${guildID}_${key}`);
if (value) {
return value;
}
else {
} else {
await db.set(`settings_${guildID}_${key}`, '');
return await db.fetch(`settings_${guildID}_${key}`);
return db.fetch(`settings_${guildID}_${key}`);
}
};
@ -34,10 +32,9 @@ exports.getBool = async (key, guildID) => {
const value = await db.fetch(`settings_${guildID}_${key}`);
if (value) {
return value;
}
else {
} else {
await db.set(`settings_${guildID}_${key}`, false);
return await db.fetch(`settings_${guildID}_${key}`);
return db.fetch(`settings_${guildID}_${key}`);
}
};

View file

@ -20,9 +20,8 @@ exports.isWhitelist = async (guildID) => {
const value = await db.fetch(`whitelist_${guildID}`);
if (value) {
return value;
}
else {
} else {
await db.set(`whitelist_${guildID}`, false);
return await db.fetch(`whitelist_${guildID}`);
return db.fetch(`whitelist_${guildID}`);
}
};