aboutsummaryrefslogtreecommitdiff
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/ask.js30
-rw-r--r--commands/avatarurl.js14
-rw-r--r--commands/ban.js23
-rw-r--r--commands/changelog.js23
-rw-r--r--commands/eval.js67
-rw-r--r--commands/git.js14
-rw-r--r--commands/help.js41
-rw-r--r--commands/invitebot.js16
-rw-r--r--commands/kick.js18
-rw-r--r--commands/ping.js14
-rw-r--r--commands/play.js71
-rw-r--r--commands/poweroff.js17
-rw-r--r--commands/purge.js21
-rw-r--r--commands/say.js18
-rw-r--r--commands/uptime.js26
15 files changed, 413 insertions, 0 deletions
diff --git a/commands/ask.js b/commands/ask.js
new file mode 100644
index 0000000..d3d0f4a
--- /dev/null
+++ b/commands/ask.js
@@ -0,0 +1,30 @@
+module.exports.run = async (client, message, args) => {
+ let abaskanswer = [
+ "Yes.",
+ "Nope. Just kidding :P",
+ "Definitely!",
+ "No.",
+ "Yep. Just kidding :P",
+ "I doubt it.",
+ "Maybe?",
+ "I don't know?",
+ "Hmm let me think :thinking:"
+ ];
+ if (args[1]) {
+ message.channel.sendMessage(abaskanswer[Math.floor(Math.random() * abaskanswer.length)]);
+ } else {
+ message.channel.sendMessage("Sorry, I don't know what your saying.")
+ }
+ };
+
+ exports.conf = {
+ aliases: ['8ball'],
+ guildOnly: false,
+ };
+ exports.help = {
+ name: 'ask',
+ description: 'Give AleeBot a question!',
+ usage: 'ask [args]',
+ category: '- Fun Commands',
+ };
+ \ No newline at end of file
diff --git a/commands/avatarurl.js b/commands/avatarurl.js
new file mode 100644
index 0000000..87e9321
--- /dev/null
+++ b/commands/avatarurl.js
@@ -0,0 +1,14 @@
+module.exports.run = async (client, message) => {
+ message.reply(message.author.avatarURL);
+};
+
+exports.conf = {
+ aliases: [],
+ guildOnly: false,
+};
+exports.help = {
+ name: 'avatarurl',
+ description: 'Sends you your avatar picture.',
+ usage: 'avatarurl',
+ category: '- Fun Commands',
+};
diff --git a/commands/ban.js b/commands/ban.js
new file mode 100644
index 0000000..a8d5c6a
--- /dev/null
+++ b/commands/ban.js
@@ -0,0 +1,23 @@
+module.exports.run = async (client, message, args) => {
+ let mreason = args.join(" ").slice(22);
+
+ if (!message.member.permissions.has('BAN_MEMBERS')) return message.reply("It looks like that you don't have the permissions to ban people.")
+ const member = message.mentions.members.first();
+ if (!member) return message.reply("Uhh... Please mention a member first.");
+ member.ban({
+ days: args[1] || null,
+ reason: `Banned by ${message.author.tag}`
+ });
+ message.reply("User Banned!");
+};
+
+exports.conf = {
+ aliases: [],
+ guildOnly: false,
+};
+exports.help = {
+ name: 'ban',
+ description: 'Bans a member',
+ usage: 'ban [user] [time]',
+ category: '- Moderation Commands',
+};
diff --git a/commands/changelog.js b/commands/changelog.js
new file mode 100644
index 0000000..2c69bb0
--- /dev/null
+++ b/commands/changelog.js
@@ -0,0 +1,23 @@
+module.exports.run = async (client, message) => {
+ const Discord = require('discord.js');
+ const embed = new Discord.RichEmbed()
+ .setAuthor('AleeBot ' + '2.3.0 ' + 'Changelog', 'https://cdn.discordapp.com/avatars/282547024547545109/6c147a444ae328c38145ef1f74169e38.png?size=2048')
+ .setDescription('What\'s new in AleeBot 2.3?')
+ .addField('[>] Purge Command!','Purge command only for moderators!', true)
+ .addField('[>] Say Command!','Say command is only for the person who created the bot!', 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/commands/eval.js b/commands/eval.js
new file mode 100644
index 0000000..a1aae92
--- /dev/null
+++ b/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/commands/git.js b/commands/git.js
new file mode 100644
index 0000000..a01d0a3
--- /dev/null
+++ b/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/commands/help.js b/commands/help.js
new file mode 100644
index 0000000..4033289
--- /dev/null
+++ b/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.3.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 2018');
+
+ 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/commands/invitebot.js b/commands/invitebot.js
new file mode 100644
index 0000000..2017cf3
--- /dev/null
+++ b/commands/invitebot.js
@@ -0,0 +1,16 @@
+module.exports.run = async (client, message) => {
+ message.reply("Continue in DMs.")
+ message.author.send('Want AleeBot in your server? Here\'s the link: https://discordapp.com/oauth2/authorize?client_id=282547024547545109&permissions=68185158&scope=bot');
+ };
+
+ exports.conf = {
+ aliases: [],
+ guildOnly: false,
+ };
+ exports.help = {
+ name: 'invitebot',
+ description: 'Invite AleeBot to your server.',
+ usage: 'invitebot',
+ category: '- General Commands',
+ };
+ \ No newline at end of file
diff --git a/commands/kick.js b/commands/kick.js
new file mode 100644
index 0000000..ffef077
--- /dev/null
+++ b/commands/kick.js
@@ -0,0 +1,18 @@
+module.exports.run = async (client, message) => {
+ if (!message.member.permissions.has('KICK_MEMBERS')) return message.reply("It looks like that you don't have the permissions to ban people.")
+ const member = message.mentions.members.first();
+ if (!member) return message.reply("Uhh... Please mention a member first.");
+ member.kick(`Kicked by: ${message.author.tag}`);
+ message.reply("User Kicked!");
+};
+
+exports.conf = {
+ aliases: [],
+ guildOnly: false,
+};
+exports.help = {
+ name: 'kick',
+ description: 'Kicks a member',
+ usage: 'kick [user]',
+ category: '- Moderation Commands',
+};
diff --git a/commands/ping.js b/commands/ping.js
new file mode 100644
index 0000000..5ad8f78
--- /dev/null
+++ b/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/commands/play.js b/commands/play.js
new file mode 100644
index 0000000..d94572e
--- /dev/null
+++ b/commands/play.js
@@ -0,0 +1,71 @@
+module.exports.run = async (client, message, args) => {
+ if (!args[0]) return await message.channel.send('A name of the song of a link is needed.');
+ if (!message.member.voiceChannelID) return await message.channel.send('You are not in a voice channel');
+ const YouTube = require('simple-youtube-api');
+ const moment = require('moment');
+ const youtube = new YouTube(client.apikey);
+ const url = args.join(' ').replace(/<(.+)>/g, '$1');
+ if (!url) return;
+ await youtube.getVideo(url)
+ .then(results => {
+ YTVideo(results);
+ })
+ .catch(() => {
+ youtube.searchVideos(args.join(' '), 1)
+ .then(results => {
+ youtube.getVideo(results[0].url)
+ .then(vid => {
+ YTVideo(vid);
+ });
+ });
+ });
+
+ const music = require('../music.js');
+ async function YTVideo(video) {
+ if (video.durationSeconds === 0) {
+ return message.channel.send('Live streams are not available');
+ }
+ const d = moment.duration({
+ s: video.durationSeconds
+ });
+
+ const server = music.MusicVariables(client, message.member.guild.id);
+ const time = moment().startOf('day').add(d).format('HH:mm:ss');
+ server.queue.push({
+ url: video.url,
+ title: video.title,
+ thumbnail: video.thumbnails.high.url,
+ duration: video.durationSeconds,
+ requested: message.author.mention,
+ playing: false
+ });
+ const { RichEmbed } = require('discord.js');
+
+ const embed = new RichEmbed()
+ .setTitle('A song has been queued')
+ .setAuthor(video.title, video.thumbnails.high.url)
+ .setColor(0x00afff)
+ .setTimestamp()
+ .addField('Title', video.title)
+ .addField('Link', video.url)
+ .addField('Duration', time)
+ .setThumbnail(video.thumbnails.high.url)
+ .setFooter('AleeBot Music Player');
+ await message.channel.send({embed});
+ if (!client.voiceConnections.get(message.member.guild.id))
+ message.member.voiceChannel.join().then(function(connection) {
+ music.playYT(client, connection, message);
+ });
+ return null;
+ }};
+
+exports.conf = {
+ aliases: [],
+ guildOnly: false,
+};
+exports.help = {
+ name: 'play',
+ description: 'Plays music',
+ usage: 'play [args]',
+ category: '- Music Commands',
+};
diff --git a/commands/poweroff.js b/commands/poweroff.js
new file mode 100644
index 0000000..8016726
--- /dev/null
+++ b/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/commands/purge.js b/commands/purge.js
new file mode 100644
index 0000000..36a0803
--- /dev/null
+++ b/commands/purge.js
@@ -0,0 +1,21 @@
+module.exports.run = async (client, message, args) => {
+ if (!message.member.permissions.has('MANAGE_MESSAGES')) return message.reply("It looks like that you don't have the permissions to delete messages.")
+ if (isNaN(args[0])) return message.reply("Please put the valid number of messages to purge.");
+
+ if (args[0] > 100) return message.channel.send("Please put a number less than 100.");
+
+ message.channel.bulkDelete(args[0])
+ .then( messages => message.channel.send(`Successfully deleted ${messages.size} messages.`))
+ };
+
+ exports.conf = {
+ aliases: ['rm'],
+ guildOnly: false,
+ };
+ exports.help = {
+ name: 'purge',
+ description: 'Removes messages in a bulk.',
+ usage: 'purge [number]',
+ category: '- Moderation Commands',
+ };
+ \ No newline at end of file
diff --git a/commands/say.js b/commands/say.js
new file mode 100644
index 0000000..dfa2323
--- /dev/null
+++ b/commands/say.js
@@ -0,0 +1,18 @@
+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.');
+ let absay = args.join(" ");
+ message.delete().catch();
+ message.channel.send(absay);
+ };
+
+ exports.conf = {
+ aliases: [],
+ guildOnly: false,
+ };
+ exports.help = {
+ name: 'say',
+ description: 'You can control AleeBot now!',
+ usage: 'say [context]',
+ category: '- Owners Only',
+ };
+ \ No newline at end of file
diff --git a/commands/uptime.js b/commands/uptime.js
new file mode 100644
index 0000000..c1c3ad7
--- /dev/null
+++ b/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',
+};