aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorAlee <alee14498@gmail.com>2018-03-24 21:23:34 -0400
committerAlee <alee14498@gmail.com>2018-03-24 21:23:34 -0400
commit0424522824916a65e31535f04b0e8e3068de8ba9 (patch)
tree4e1d70364647acee4cb4bd2c04102b1f74ba0ed8 /src/commands
parent8dfcf2917c4ddebb701044c54dc73f3f72265eae (diff)
parenteab57f6d81f66fdf9b930854df7f382dc8b80642 (diff)
downloadAleeBot-0424522824916a65e31535f04b0e8e3068de8ba9.tar.gz
AleeBot-0424522824916a65e31535f04b0e8e3068de8ba9.tar.bz2
AleeBot-0424522824916a65e31535f04b0e8e3068de8ba9.zip
Merge branch 'beta'
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/ban.js23
-rw-r--r--src/commands/changelog.js9
-rw-r--r--src/commands/help.js2
-rw-r--r--src/commands/kick.js18
-rw-r--r--src/commands/play.js71
5 files changed, 117 insertions, 6 deletions
diff --git a/src/commands/ban.js b/src/commands/ban.js
new file mode 100644
index 0000000..a8d5c6a
--- /dev/null
+++ b/src/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/src/commands/changelog.js b/src/commands/changelog.js
index 0fff14a..be41192 100644
--- a/src/commands/changelog.js
+++ b/src/commands/changelog.js
@@ -1,11 +1,10 @@
module.exports.run = async (client, message) => {
const Discord = require('discord.js');
const embed = new Discord.RichEmbed()
- .setAuthor('AleeBot ' + '2.1.0 Beta ' + 'Changelog', 'https://cdn.discordapp.com/avatars/282547024547545109/6c147a444ae328c38145ef1f74169e38.png?size=2048')
- .setDescription('What\'s new in AleeBot 2.1 Beta?')
- .addField('! Coming soon music commands!', true)
- .addField('! Coming soon moderation commands!', true)
- .addField('And even more!', true)
+ .setAuthor('AleeBot ' + '2.2.0 ' + 'Changelog', 'https://cdn.discordapp.com/avatars/282547024547545109/6c147a444ae328c38145ef1f74169e38.png?size=2048')
+ .setDescription('What\'s new in AleeBot 2.2?')
+ .addField('[>] Music Command!','ab:play [music or url]', true)
+ .addField('[>] Moderation Commands!','Kick and Ban has been added!', true)
.setFooter('AleeCorp Copyright 2017')
.setColor('#1fd619');
message.channel.sendEmbed(embed);
diff --git a/src/commands/help.js b/src/commands/help.js
index 27add92..690c91c 100644
--- a/src/commands/help.js
+++ b/src/commands/help.js
@@ -11,7 +11,7 @@ module.exports.run = async (client, message) => {
const embed = new Discord.RichEmbed()
.setTitle('AleeBot Help')
- .setAuthor('AleeBot 2.1.0' + ` Help and on ${client.guilds.size} servers`, 'https://cdn.discordapp.com/avatars/282547024547545109/6c147a444ae328c38145ef1f74169e38.png?size=2048')
+ .setAuthor('AleeBot 2.2.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');
diff --git a/src/commands/kick.js b/src/commands/kick.js
new file mode 100644
index 0000000..ffef077
--- /dev/null
+++ b/src/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/src/commands/play.js b/src/commands/play.js
new file mode 100644
index 0000000..d94572e
--- /dev/null
+++ b/src/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',
+};