aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlee <alee14498@gmail.com>2018-08-01 22:46:19 -0400
committerAlee <alee14498@gmail.com>2018-08-01 22:46:19 -0400
commit5881cae922e44a93cff005f497dd02e7bbdfaee9 (patch)
tree247648ba71df8afe844795e39448a64c2df4ceb8
parent8187456565b286e8e9fd2402c999fbe34db16604 (diff)
downloadPokeBot-5881cae922e44a93cff005f497dd02e7bbdfaee9.tar.gz
PokeBot-5881cae922e44a93cff005f497dd02e7bbdfaee9.tar.bz2
PokeBot-5881cae922e44a93cff005f497dd02e7bbdfaee9.zip
Added features from AleeBot
-rw-r--r--bot.js140
-rw-r--r--commands/Owners Only/leaveguild.js25
-rw-r--r--commands/Universe Exclusive/interrogate.js32
-rw-r--r--commands/Universe Exclusive/jail.js32
-rw-r--r--commands/Utility/info.js32
-rw-r--r--commands/Utility/quote.js54
-rw-r--r--commands/Utility/vtquote.js54
-rw-r--r--package.json2
-rw-r--r--plugins/economy.js41
9 files changed, 347 insertions, 65 deletions
diff --git a/bot.js b/bot.js
index 76aac09..71a628c 100644
--- a/bot.js
+++ b/bot.js
@@ -92,74 +92,86 @@ 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}`);
- }
+rl.on('line', function(cmd){
+ var args = cmd.split(" ");
+ switch(args[0]) {
+ case "guilds":
+ if (client.guilds.size === 0) {
+ console.log(('[!] No guilds found.'));
+ } else {
+ console.log('[i] Here\'s the servers that Galaxy is connected to:')
+ for ([id, guild] of client.guilds) {
+ console.log(` Guild Name: ${guild.name} - ID: ${guild.id}`);
+ }
+ }
+ break;
+ case "channels":
+ if (!args[1]) {
+ console.log('[!] Please insert the guild\'s ID.')
+ } else {
+ var guild = client.guilds.get(args[1]);
+ console.log('[i] Here\'s the channels that this guild have:')
+ for ([id, channel, guild] of guild && client.channels) {
+ console.log(` Channel: #${channel.name} - ID: ${channel.id}`);
+ }
+ }
+ break;
+ case "leave":
+ if (!args[1]) {
+ console.log('[!] Please insert the guild\'s ID.');
+ } else {
+ var guild = client.guilds.get(args[1]);
+ guild.leave();
+ }
+ break;
+ case "broadcast":
+ if (!args[1]) {
+ console.log('[!] Usage: broadcast [guildID] [channelID].');
+ } else {
+ let broadcast = args.join(" ").slice(48);
+ var guild = null;
+ guild = client.guilds.get(args[1]);
+ var channel = null;
+ channel = guild.channels.get(args[2])
+ if (channel != null) {
+ channel.send(broadcast);
+ }
+ }
+ break;
+ case "uptime":
+ let uptime = parseInt(client.uptime);
+ uptime = Math.floor(uptime / 1000);
+ let uptimeMinutes = Math.floor(uptime / 60);
+ const minutes = uptime % 60;
+ let hours = 0;
+ while (uptimeMinutes >= 60) {
+ hours++;
+ uptimeMinutes = uptimeMinutes - 60;
}
+ const uptimeSeconds = minutes % 60;
+ console.log(`[i] Galaxy has been up for ${hours} hours, ${uptimeMinutes} minutes, and ${uptimeSeconds} seconds.`);
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 && client.channels) {
- console.log(` Channel: #${channel.name} - ID: ${channel.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 '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]');
- }
- }
- break;
- case 'exit':
- console.log('[i] PokeBot will now exit!');
- 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...');
+ case "exit":
+ console.log('[i] Galaxy will now exit!.')
+ process.exit(0);
+ break;
+ case "help":
+ var msg = (`Galaxy 2.0 Alpha 1 Console Help\n\n`);
+ msg += (`guilds - Shows all guilds that Galaxy'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 += (`uptime - Shows the uptime for Galaxy.\n`)
+ msg += (`help - Shows this command.\n`)
+ msg += (`exit - Exits Galaxy.\n`)
+ console.log(msg);
+ break;
+ default:
+ console.log('Unknown command, type \'help\' to list the commands...'.yellow)
}
rl.prompt();
-});*/
+});
+
process.on('unhandledRejection', (err) => {
console.error(err.stack);
diff --git a/commands/Owners Only/leaveguild.js b/commands/Owners Only/leaveguild.js
new file mode 100644
index 0000000..a28b442
--- /dev/null
+++ b/commands/Owners Only/leaveguild.js
@@ -0,0 +1,25 @@
+/****************************************
+ *
+ * LeaveGuild: Plugin for Galaxy that leaves a guild
+ * Copyright (C) 2018 TheEdge, jtsshieh, Alee
+ *
+ * Licensed under the Open Software License version 3.0
+ *
+ * *************************************/
+module.exports.run = async (client, message) => {
+ if (!['242775871059001344', '247221105515823104', '236279900728721409', message.guild.owner.user.id].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot or the owner of this guild to use this command.');
+ message.channel.send('Alright, I\'m leaving the server now. Bye everyone!')
+ message.guild.leave();
+ };
+
+ exports.conf = {
+ aliases: [],
+ guildOnly: false,
+ };
+ exports.help = {
+ name: 'leaveguild',
+ description: 'Makes the bot leave the server',
+ usage: 'leaveguild',
+ category: '- Owners Only',
+ };
+ \ No newline at end of file
diff --git a/commands/Universe Exclusive/interrogate.js b/commands/Universe Exclusive/interrogate.js
new file mode 100644
index 0000000..faf888f
--- /dev/null
+++ b/commands/Universe Exclusive/interrogate.js
@@ -0,0 +1,32 @@
+/****************************************
+ *
+ * Interrogate: Plugin for Galaxy that interrogates users
+ * Copyright (C) 2018 TheEdge, jtsshieh, Alee
+ *
+ * Licensed under the Open Software License version 3.0
+ *
+ * *************************************/
+module.exports.run = async (client, message, args) => {
+ if (message.guild.id != '243022206437687296') return message.reply ('This is a ACN exclusive command.');
+
+ if (!message.member.hasPermission('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to jail members.');
+ if (!message.guild.member(client.user).hasPermission('MANAGE_ROLES')) return message.reply('Uhh... I don\'t have permission to jail members.');
+
+ const member = message.mentions.members.first();
+ if (!member) return await message.reply('Uhh... Please mention a member first.');
+
+ member.addRole(message.guild.roles.find('name', 'Interrogation'));
+ message.reply(`Alright, I just interrogated ${member.user.tag}.`)
+};
+
+exports.conf = {
+ aliases: [],
+ guildOnly: false,
+ };
+ exports.help = {
+ name: 'interrogate',
+ description: 'Interrogates a member',
+ usage: 'interrogate [user]',
+ category: '- ACN Exclusive Commands',
+ };
+ \ No newline at end of file
diff --git a/commands/Universe Exclusive/jail.js b/commands/Universe Exclusive/jail.js
new file mode 100644
index 0000000..f78e9e3
--- /dev/null
+++ b/commands/Universe Exclusive/jail.js
@@ -0,0 +1,32 @@
+/****************************************
+ *
+ * Jail: Plugin for Galaxy that Jails users
+ * Copyright (C) 2018 TheEdge, jtsshieh, Alee
+ *
+ * Licensed under the Open Software License version 3.0
+ *
+ * *************************************/
+module.exports.run = async (client, message, args) => {
+ if (message.guild.id != '243022206437687296') return message.reply ('This is a ACN exclusive command.');
+
+ if (!message.member.hasPermission('BAN_MEMBERS')) return message.reply('It looks like that you don\'t have the permissions to jail members.');
+ if (!message.guild.member(client.user).hasPermission('MANAGE_ROLES')) return message.reply('Uhh... I don\'t have permission to jail members.');
+
+ const member = message.mentions.members.first();
+ if (!member) return await message.reply('Uhh... Please mention a member first.');
+
+ member.addRole(message.guild.roles.find('name', 'Jail'));
+ message.reply(`Alright, I just jailed ${member.user.tag}.`)
+};
+
+exports.conf = {
+ aliases: [],
+ guildOnly: false,
+ };
+ exports.help = {
+ name: 'jail',
+ description: 'Jails a member',
+ usage: 'jail [user]',
+ category: '- ACN Exclusive Commands',
+ };
+ \ No newline at end of file
diff --git a/commands/Utility/info.js b/commands/Utility/info.js
new file mode 100644
index 0000000..d75e399
--- /dev/null
+++ b/commands/Utility/info.js
@@ -0,0 +1,32 @@
+/****************************************
+ *
+ * Info: Plugin for Galaxy that tells you about the server host info.
+ * Copyright (C) 2018 TheEdge, jtsshieh, Alee
+ *
+ * Licensed under the Open Software License version 3.0
+ *
+ * *************************************/
+module.exports.run = async (client, message) => {
+ const Discord = require('discord.js');
+ const os = require('os');
+ const embed = new Discord.RichEmbed()
+ .setTitle('Information on AleeBot\'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('#1fd619');
+ message.channel.send({embed});
+ };
+
+ exports.conf = {
+ aliases: [],
+ guildOnly: false,
+ };
+ exports.help = {
+ name: 'info',
+ description: 'Tells you information about the bot',
+ usage: 'info',
+ category: '- Information Commands',
+ };
+ \ No newline at end of file
diff --git a/commands/Utility/quote.js b/commands/Utility/quote.js
new file mode 100644
index 0000000..8098400
--- /dev/null
+++ b/commands/Utility/quote.js
@@ -0,0 +1,54 @@
+/****************************************
+ *
+ * Quote: Plugin for Galaxy that gives you quotes.
+ * Copyright (C) 2018 TheEdge, jtsshieh, Alee
+ *
+ * Licensed under the Open Software License version 3.0
+ *
+ * *************************************/
+module.exports.run = async (client, message) => {
+const Discord = require('discord.js');
+
+let NewQuote;
+
+ function GetNewQuote(quoteNum = -1) {
+ NewQuote = new Discord.RichEmbed();
+
+ let quo = require('../assets/quotes.json').quotes
+
+ if (quoteNum == -1) {
+ quoteNum = Math.floor(Math.random() * 1000) % quo.length;
+ quo=quo[quoteNum];
+ }
+
+ const author = quo.author;
+ const authorImage = quo.authorImage;
+ const quote = quo.quote;
+ const year = quo.year;
+ const url = quo.url;
+
+ NewQuote.setAuthor(author, authorImage);
+ NewQuote.setColor('#1fd619');
+ NewQuote.setDescription(quote);
+ NewQuote.setFooter('- ' + year);
+ NewQuote.setURL(url);
+
+ return NewQuote;
+ }
+
+ const newquote = GetNewQuote();
+ message.reply('Alright, here\'s your quote.')
+ message.channel.send(newquote);
+};
+
+exports.conf = {
+ aliases: [],
+ guildOnly: false,
+ };
+ exports.help = {
+ name: 'quote',
+ description: 'Tells you quotes',
+ usage: 'quote',
+ category: '- Quote Commands',
+ };
+ \ No newline at end of file
diff --git a/commands/Utility/vtquote.js b/commands/Utility/vtquote.js
new file mode 100644
index 0000000..ec85888
--- /dev/null
+++ b/commands/Utility/vtquote.js
@@ -0,0 +1,54 @@
+/****************************************
+ *
+ * VTQuote: Plugin for Galaxy that tells you VT quotes.
+ * Copyright (C) 2018 TheEdge, jtsshieh, Alee
+ *
+ * Licensed under the Open Software License version 3.0
+ *
+ * *************************************/
+module.exports.run = async (client, message) => {
+ const Discord = require('discord.js');
+
+ let VictorQuote;
+
+ function GetVictorQuote(quoteNum = -1) {
+ VictorQuote = new Discord.RichEmbed();
+
+ let quo = require('../assets/vtquotes.json').quotes
+
+ if (quoteNum == -1) {
+ quoteNum = Math.floor(Math.random() * 1000) % quo.length;
+ quo=quo[quoteNum];
+ }
+
+ const author = quo.author;
+ const authorImage = quo.authorImage;
+ const quote = quo.quote;
+ const year = quo.year;
+ const url = quo.url;
+
+ VictorQuote.setAuthor(author, authorImage);
+ VictorQuote.setColor('#1fd619');
+ VictorQuote.setDescription(quote);
+ VictorQuote.setFooter('- ' + year);
+ VictorQuote.setURL(url);
+
+ return VictorQuote;
+ }
+
+ const victorquote = GetVictorQuote();
+ message.reply('Alright, here\'s your Victor quote.')
+ message.channel.send(victorquote);
+ };
+
+ exports.conf = {
+ aliases: [],
+ guildOnly: false,
+ };
+ exports.help = {
+ name: 'vtquote',
+ description: 'Tells you quotes when victor accidentaly swore.',
+ usage: 'vtquote',
+ category: '- Quote Commands',
+ };
+ \ No newline at end of file
diff --git a/package.json b/package.json
index ff173fe..249d3cb 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,5 @@
{
- "name": "pokebot",
+ "name": "galaxybot",
"version": "1.0.0",
"description": "",
"main": "bot.js",
diff --git a/plugins/economy.js b/plugins/economy.js
new file mode 100644
index 0000000..8b07e0c
--- /dev/null
+++ b/plugins/economy.js
@@ -0,0 +1,41 @@
+
+/** **************************************
+ *
+ * Economy: Plugin for Galaxy that enables economy features.
+ * Copyright (C) 2018 TheEdge, jtsshieh, Alee
+ *
+ * Licensed under the Open Software License version 3.0
+ *
+ * *************************************/
+
+const db = require('quick.db');
+exports.get = async (userid) => {
+ const amount = await db.fetch(`money_${userid}`);
+ if (amount) {
+ return amount;
+ }
+ else {
+ await db.set(`money_${userid}`, 0);
+ return await db.fetch(`money_${userid}`);
+ }
+};
+
+exports.add = async (userid, money) => {
+ const amount = await db.fetch(`money_${userid}`);
+ if (amount) {
+ await db.set(`money_${userid}`, amount + money);
+ }
+ else {
+ await db.set(`money_${userid}`, money);
+ }
+};
+
+exports.subtract = async (userid, money) => {
+ const amount = await db.fetch(`money_${userid}`);
+ if (amount) {
+ await db.set(`money_${userid}`, amount - money);
+ }
+ else {
+ await db.set(`money_${userid}`, 0 - money);
+ }
+}; \ No newline at end of file