summaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorAlee <alee14498@gmail.com>2018-02-25 14:54:37 -0500
committerAlee <alee14498@gmail.com>2018-02-25 14:54:37 -0500
commit3e06bff720bd660ef41ce2e149004836595b4e40 (patch)
tree0f66307832ceca562df3d13bbdd6fd46e4625ac5 /src/commands
parent2297ebb012e5522ce3b8360c404f522ed30dd985 (diff)
parent94eeeec5b7d4d29ae9d372fc1b86ce5351112548 (diff)
downloadAleeBot-3e06bff720bd660ef41ce2e149004836595b4e40.tar.gz
AleeBot-3e06bff720bd660ef41ce2e149004836595b4e40.tar.bz2
AleeBot-3e06bff720bd660ef41ce2e149004836595b4e40.zip
2.0 release (I hope it will work)
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/changelog.js24
-rw-r--r--src/commands/eval.js67
-rw-r--r--src/commands/git.js14
-rw-r--r--src/commands/help.js41
-rw-r--r--src/commands/ping.js14
-rw-r--r--src/commands/poweroff.js17
-rw-r--r--src/commands/uptime.js26
7 files changed, 203 insertions, 0 deletions
diff --git a/src/commands/changelog.js b/src/commands/changelog.js
new file mode 100644
index 0000000..88df4bd
--- /dev/null
+++ b/src/commands/changelog.js
@@ -0,0 +1,24 @@
+module.exports.run = async (client, message) => {
+ const Discord = require('discord.js');
+ const embed = new Discord.RichEmbed()
+ .setAuthor('AleeBot ' + '2.0.0 Beta ' + 'Changelog', 'https://cdn.discordapp.com/avatars/282547024547545109/6c147a444ae328c38145ef1f74169e38.png?size=2048')
+ .setDescription('What\'s new in AleeBot 2.0?')
+ .addField('+ Rewritten command handler (Written by jtsshieh big thanks to him!)', true)
+ .addField('+ New uptime command (Thanks to Rain)', true)
+ .addField('? Some commands are the same from 1.x', true)
+ .setFooter('AleeCorp Copyright 2017')
+ .setColor('#1fd619');
+ message.channel.sendEmbed(embed);
+
+};
+
+exports.conf = {
+ aliases: [],
+ guildOnly: false,
+};
+exports.help = {
+ name: 'changelog',
+ description: 'What\'s new',
+ usage: 'changelog',
+ category: '- General Commands',
+};
diff --git a/src/commands/eval.js b/src/commands/eval.js
new file mode 100644
index 0000000..a1aae92
--- /dev/null
+++ b/src/commands/eval.js
@@ -0,0 +1,67 @@
+module.exports.run = async (client, message, args) => {
+ if (!['242775871059001344',].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot to use this command.');
+ const { RichEmbed } = require('discord.js');
+ const code = args.join(' ');
+
+ let evaled;
+ let remove;
+
+ try {
+ remove = text => {
+ if (typeof(text) === 'string') {
+ return text.replace(/`/g, '`' + String.fromCharCode(8203)).replace(/@/g, '@' + String.fromCharCode(8203));
+ } else {
+ return text;
+ }
+ };
+
+ evaled = eval(code);
+
+ if (typeof evaled !== 'string') {
+ evaled = require('util').inspect(evaled);
+ }
+
+ } catch (err) {
+ const embed = new RichEmbed()
+ .setAuthor('Eval Error')
+ .setDescription('Eval\'s result')
+ .addField(':inbox_tray: Input:', `\`\`\`js\n${code}\n\`\`\``)
+ .addField(':outbox_tray: Output:', `\`\`\`${err}\`\`\``)
+ .setFooter('Eval', client.user.avatarURL)
+ .setColor('RED');
+ return message.channel.send({ embed });
+ }
+
+ try {
+ const embed = new RichEmbed()
+ .setAuthor('Eval Success')
+ .setDescription('Eval\'s result')
+ .addField(':inbox_tray: Input:', `\`\`\`js\n${code}\n\`\`\``)
+ .addField(':outbox_tray: Output:', `\`\`\`js\n${remove(evaled)}\n\`\`\``)
+ .setFooter('Eval', client.user.avatarURL)
+ .setColor('GREEN');
+
+ return message.channel.send({ embed });
+ } catch (err) {
+ const embed = new RichEmbed()
+ .setAuthor('Eval Error')
+ .setDescription('Eval\'s result')
+ .addField(':inbox_tray: Input:', `\`\`\`js\n${code}\n\`\`\``)
+ .addField(':outbox_tray: Output:', `\`\`\`${err}\`\`\``)
+ .setFooter('Eval', client.user.avatarURL)
+ .setColor('RED');
+ return message.channel.send({ embed });
+ }
+ };
+
+ exports.conf = {
+ aliases: [],
+ guildOnly: false,
+ };
+ exports.help = {
+ name: 'eval',
+ description: 'Evalulates commands.',
+ usage: '<code>',
+ category: '- Owners Only',
+ };
+ \ No newline at end of file
diff --git a/src/commands/git.js b/src/commands/git.js
new file mode 100644
index 0000000..a01d0a3
--- /dev/null
+++ b/src/commands/git.js
@@ -0,0 +1,14 @@
+module.exports.run = async (client, message) => {
+ message.author.send('I can see you want to contribute to this project.\nHere\'s the link: https://github.com/AleeCorp/AleeBot');
+};
+
+exports.conf = {
+ aliases: [],
+ guildOnly: false,
+};
+exports.help = {
+ name: 'git',
+ description: 'Get the git info.',
+ usage: 'git',
+ category: '- General Commands',
+};
diff --git a/src/commands/help.js b/src/commands/help.js
new file mode 100644
index 0000000..888ca38
--- /dev/null
+++ b/src/commands/help.js
@@ -0,0 +1,41 @@
+const Discord = require('discord.js');
+module.exports.run = async (client, message) => {
+ const categories = [];
+ const commands = Array.from(client.commands.keys());
+
+ commands.forEach(function(x) {
+ if (!categories.includes(client.commands.get(x).help.category)) {
+ categories.push(client.commands.get(x).help.category);
+ }
+ });
+
+ const embed = new Discord.RichEmbed()
+ .setTitle('AleeBot Help')
+ .setAuthor('AleeBot 2.0.0' + ` Help and on ${client.guilds.size} servers`, 'https://cdn.discordapp.com/avatars/282547024547545109/6c147a444ae328c38145ef1f74169e38.png?size=2048')
+ .setDescription('Every command you input into AleeBot is `' + require('../absettings.json').prefix + '`')
+ .setColor('#1fd619')
+ .setFooter('AleeCorp Copyright 2017');
+
+ categories.forEach(function(x) {
+ let cat = '';
+ commands.forEach(function(command) {
+ if (client.commands.get(command).help.category == x) {
+ cat = cat + command + '\n';
+ }
+ });
+ embed.addField(x, cat);
+ });
+
+ await message.channel.send({ embed });
+};
+
+exports.conf = {
+ aliases: ['h'],
+ guildOnly: false,
+};
+exports.help = {
+ name: 'help',
+ description: 'Displays all the commands or a page with information for 1 command.',
+ usage: 'help (command:command-name)',
+ category: '- General Commands',
+};
diff --git a/src/commands/ping.js b/src/commands/ping.js
new file mode 100644
index 0000000..5ad8f78
--- /dev/null
+++ b/src/commands/ping.js
@@ -0,0 +1,14 @@
+module.exports.run = async (client, message) => {
+ message.reply('**PONG!** :ping_pong: ' + Math.round(client.ping) + ' ms');
+};
+
+exports.conf = {
+ aliases: [],
+ guildOnly: false,
+};
+exports.help = {
+ name: 'ping',
+ description: 'Ping the bot.',
+ usage: 'ping',
+ category: '- General Commands',
+};
diff --git a/src/commands/poweroff.js b/src/commands/poweroff.js
new file mode 100644
index 0000000..8016726
--- /dev/null
+++ b/src/commands/poweroff.js
@@ -0,0 +1,17 @@
+module.exports.run = async (client, message, args) => {
+ if (!['242775871059001344',].includes(message.author.id)) return message.reply('Nope! You need the person who created this bot to use this command.');
+ await message.reply(':warning: AleeBot will now exit!');
+ process.exit(0);
+ };
+
+ exports.conf = {
+ aliases: ['reboot'],
+ guildOnly: false,
+ };
+ exports.help = {
+ name: 'poweroff',
+ description: 'Turns off AleeBot.',
+ usage: 'poweroff',
+ category: '- Owners Only',
+ };
+ \ No newline at end of file
diff --git a/src/commands/uptime.js b/src/commands/uptime.js
new file mode 100644
index 0000000..c1c3ad7
--- /dev/null
+++ b/src/commands/uptime.js
@@ -0,0 +1,26 @@
+module.exports.run = async (client, message) => {
+
+ 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;
+ message.channel.send(':clock3: AleeBot has been up for ' + hours + ' hours, ' + uptimeMinutes + ' minutes, and ' + uptimeSeconds + ' seconds.');
+
+};
+
+exports.conf = {
+ aliases: [],
+ guildOnly: false,
+};
+exports.help = {
+ name: 'uptime',
+ description: 'Displays Uptime.',
+ usage: 'uptime',
+ category: '- General Commands',
+};