aboutsummaryrefslogtreecommitdiff
path: root/To be worked on
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2020-07-23 11:41:02 -0400
committerAndrew Lee <alee14498@protonmail.com>2020-07-23 11:41:02 -0400
commited456ef581c5acd852a924d9cc274a259b2d8ce5 (patch)
tree33be62f54239fa6f6b61b9488dbfde329ae1fd78 /To be worked on
parent1ce861095b2793a1b49546c0adf460fbc2fc5d9f (diff)
downloadAleeBot-ed456ef581c5acd852a924d9cc274a259b2d8ce5.tar.gz
AleeBot-ed456ef581c5acd852a924d9cc274a259b2d8ce5.tar.bz2
AleeBot-ed456ef581c5acd852a924d9cc274a259b2d8ce5.zip
Converted to Discord.JS v12, starting database
Diffstat (limited to 'To be worked on')
-rw-r--r--To be worked on/leave.js22
-rw-r--r--To be worked on/play.js136
-rw-r--r--To be worked on/queue.js30
-rw-r--r--To be worked on/skip.js40
4 files changed, 114 insertions, 114 deletions
diff --git a/To be worked on/leave.js b/To be worked on/leave.js
index 63915c8..da0b4cc 100644
--- a/To be worked on/leave.js
+++ b/To be worked on/leave.js
@@ -19,24 +19,24 @@
* *************************************/
module.exports.run = async (client, message, args) => {
- if (!message.member.voiceChannel) return message.reply('You need a voice channel to perform this action.');
+ if (!message.member.voiceChannel) return message.reply('You need a voice channel to perform this action.');
- if (!message.guild.me.voiceChannel) return message.reply('Error: The bot isn\'t connected to a voice channel.');
+ if (!message.guild.me.voiceChannel) return message.reply('Error: The bot isn\'t connected to a voice channel.');
- if (message.guild.me.voiceChannelID !== message.member.voiceChannelID) return message.reply('Error: You aren\'t connected in the same voice channel as the bot...');
+ if (message.guild.me.voiceChannelID !== message.member.voiceChannelID) return message.reply('Error: You aren\'t connected in the same voice channel as the bot...');
- message.guild.me.voiceChannel.leave();
+ message.guild.me.voiceChannel.leave();
- message.channel.send('Leaving channel...');
+ message.channel.send('Leaving channel...');
};
exports.conf = {
- aliases: [],
- guildOnly: false,
+ aliases: [],
+ guildOnly: false,
};
exports.help = {
- name: 'leave',
- description: 'Leaves voice chat.',
- usage: 'leave',
- category: '- Music Commands',
+ name: 'leave',
+ description: 'Leaves voice chat.',
+ usage: 'leave',
+ category: '- Music Commands',
};
diff --git a/To be worked on/play.js b/To be worked on/play.js
index 71112e1..abebc8b 100644
--- a/To be worked on/play.js
+++ b/To be worked on/play.js
@@ -19,97 +19,97 @@
* *************************************/
module.exports.run = async (client, message, args, ops) => {
- const ytdl = require('ytdl-core');
+ const ytdl = require('ytdl-core');
- if (!message.member.voiceChannel) return message.reply('Please connect to a voice channel...');
+ if (!message.member.voiceChannel) return message.reply('Please connect to a voice channel...');
- if (!args[0]) return message.reply('Please input a url.');
+ if (!args[0]) return message.reply('Please input a url.');
- const vaildate = await ytdl.validateURL(args[0]);
+ const vaildate = await ytdl.validateURL(args[0]);
- if (!vaildate) return message.reply('Please input a **valid** url.');
+ if (!vaildate) return message.reply('Please input a **valid** url.');
- const info = await ytdl.getInfo(args[0]);
+ const info = await ytdl.getInfo(args[0]);
- const data = ops.active.get(message.guild.id) || {};
+ const data = ops.active.get(message.guild.id) || {};
- if (!data.connection) data.connection = await message.member.voiceChannel.join();
- if (!data.queue) data.queue = [];
- data.guildID = message.guild.id;
+ if (!data.connection) data.connection = await message.member.voiceChannel.join();
+ if (!data.queue) data.queue = [];
+ data.guildID = message.guild.id;
- data.queue.push({
- songTitle: info.title,
- requester: message.author.tag,
- url: args[0],
- announceChannel: message.channel.id,
- });
- if (!data.dispatcher) play(client, ops, data);
- else {
- const {RichEmbed} = require('discord.js');
- const embed = new RichEmbed()
- .setTitle('This music has been added to the queue!')
- .setAuthor(info.title, client.user.avatarURL)
- .setColor(0x00afff)
- .setTimestamp()
- .addField('Title', info.title)
- .addField('Requested by:', message.author.tag)
- .setFooter('AleeBot Music Player');
+ data.queue.push({
+ songTitle: info.title,
+ requester: message.author.tag,
+ url: args[0],
+ announceChannel: message.channel.id,
+ });
+ if (!data.dispatcher) play(client, ops, data);
+ else {
+ const {MessageEmbed} = require('discord.js');
+ const embed = new MessageEmbed()
+ .setTitle('This music has been added to the queue!')
+ .setAuthor(info.title, client.user.avatarURL())
+ .setColor(0x00afff)
+ .setTimestamp()
+ .addField('Title', info.title)
+ .addField('Requested by:', message.author.tag)
+ .setFooter('AleeBot Music Player');
- message.channel.send({embed});
- }
+ message.channel.send({embed});
+ }
- ops.active.set(message.guild.id, data);
+ ops.active.set(message.guild.id, data);
};
async function play(client, ops, data) {
- const ytdl = require('ytdl-core');
- const {RichEmbed} = require('discord.js');
- const embed = new RichEmbed()
- .setTitle('Now playing!')
- .setAuthor(data.queue[0].songTitle, client.user.avatarURL)
- .setColor(0x00afff)
- .setTimestamp()
- .addField('Title', data.queue[0].songTitle)
- .addField('Requested by:', data.queue[0].requester)
- // .addField('Link', info.url)
- // .addField('Duration', time)
- .setFooter('AleeBot Music Player');
-
- client.channels.get(data.queue[0].announceChannel).send({embed});
-
- data.dispatcher = await data.connection.playStream(ytdl(data.queue[0].url, {filter: 'audioonly'}));
- data.dispatcher.guildID = data.guildID;
-
- data.dispatcher.once('finish', function() {
- finish(client, ops, this);
- });
-};
+ const ytdl = require('ytdl-core');
+ const {MessageEmbed} = require('discord.js');
+ const embed = new MessageEmbed()
+ .setTitle('Now playing!')
+ .setAuthor(data.queue[0].songTitle, client.user.avatarURL())
+ .setColor(0x00afff)
+ .setTimestamp()
+ .addField('Title', data.queue[0].songTitle)
+ .addField('Requested by:', data.queue[0].requester)
+ // .addField('Link', info.url)
+ // .addField('Duration', time)
+ .setFooter('AleeBot Music Player');
+
+ client.channels.get(data.queue[0].announceChannel).send({embed});
+
+ data.dispatcher = await data.connection.playStream(ytdl(data.queue[0].url, {filter: 'audioonly'}));
+ data.dispatcher.guildID = data.guildID;
+
+ data.dispatcher.once('finish', function() {
+ finish(client, ops, this);
+ });
+}
function finish(client, ops, dispatcher) {
- const fetched = ops.active.get(dispatcher.guildID);
+ const fetched = ops.active.get(dispatcher.guildID);
- fetched.queue.shift();
+ fetched.queue.shift();
- if (fetched.queue.length > 0) {
- ops.active.set(dispatcher.guildID, fetched);
+ if (fetched.queue.length > 0) {
+ ops.active.set(dispatcher.guildID, fetched);
- play(client, ops, fetched);
- } else {
- ops.active.delete(dispatcher.guildID);
+ play(client, ops, fetched);
+ } else {
+ ops.active.delete(dispatcher.guildID);
- const vc = client.guild.get(dispatcher.guildID).me.voiceChannel;
+ const vc = client.guild.get(dispatcher.guildID).me.voiceChannel;
- if (vc) vc.leave();
- }
+ if (vc) vc.leave();
+ }
}
exports.conf = {
- aliases: [],
- guildOnly: false,
+ aliases: [],
+ guildOnly: false,
};
exports.help = {
- name: 'play',
- description: 'Plays music.',
- usage: 'play [url]',
- category: '- Music Commands',
+ name: 'play',
+ description: 'Plays music.',
+ usage: 'play [url]',
+ category: '- Music Commands',
};
diff --git a/To be worked on/queue.js b/To be worked on/queue.js
index f5f0ae9..1208ddf 100644
--- a/To be worked on/queue.js
+++ b/To be worked on/queue.js
@@ -19,29 +19,29 @@
* *************************************/
module.exports.run = async (client, message, args, ops) => {
- const fetched = ops.active.get(message.guild.id);
+ const fetched = ops.active.get(message.guild.id);
- if (!fetched) return message.reply('Currently, there isn\'t any music playing in this guild.');
+ if (!fetched) return message.reply('Currently, there isn\'t any music playing in this guild.');
- const queue = fetched.queue;
- const nowPlaying = queue[0];
+ const queue = fetched.queue;
+ const nowPlaying = queue[0];
- let resp = `__**Now Playing**__\n**${nowPlaying.songTitle}** -- **Requested By:** *${nowPlaying.requester}*\n\n__**Queue**__\n`;
+ let resp = `__**Now Playing**__\n**${nowPlaying.songTitle}** -- **Requested By:** *${nowPlaying.requester}*\n\n__**Queue**__\n`;
- for (let i = 1; i < queue.length; i++) {
- resp += `${i}. **${queue[i].songTitle}** -- **Requested By:** *${queue[i].requester}*\n`;
- }
+ for (let i = 1; i < queue.length; i++) {
+ resp += `${i}. **${queue[i].songTitle}** -- **Requested By:** *${queue[i].requester}*\n`;
+ }
- message.channel.send(resp);
+ message.channel.send(resp);
};
exports.conf = {
- aliases: [],
- guildOnly: false,
+ aliases: [],
+ guildOnly: false,
};
exports.help = {
- name: 'queue',
- description: 'Checks what music is in queue.',
- usage: 'queue',
- category: '- Music Commands',
+ name: 'queue',
+ description: 'Checks what music is in queue.',
+ usage: 'queue',
+ category: '- Music Commands',
};
diff --git a/To be worked on/skip.js b/To be worked on/skip.js
index 965b013..371e7e7 100644
--- a/To be worked on/skip.js
+++ b/To be worked on/skip.js
@@ -19,40 +19,40 @@
* *************************************/
module.exports.run = async (client, message, args, ops) => {
- const fetched = ops.active.get(message.guild.id);
+ const fetched = ops.active.get(message.guild.id);
- if (!fetched) return message.reply('Currently, there isn\'t any music playing in this guild.');
+ if (!fetched) return message.reply('Currently, there isn\'t any music playing in this guild.');
- if (message.member.voiceChannel !== message.guild.me.voiceChannel) return message.reply('Sorry, you are currently not in the same channel as the bot.');
+ if (message.member.voiceChannel !== message.guild.me.voiceChannel) return message.reply('Sorry, you are currently not in the same channel as the bot.');
- const userCount = message.member.voiceChannel.members.size;
+ const userCount = message.member.voiceChannel.members.size;
- const required = Math.ceil(userCount/2);
+ const required = Math.ceil(userCount/2);
- if (!fetched.queue[0].voteSkips) fetched.queue[0].voteSkips = [];
+ if (!fetched.queue[0].voteSkips) fetched.queue[0].voteSkips = [];
- if (fetched.queue[0].voteSkips.includes(message.member.id)) return message.reply(`Sorry, you have already voted to skip! ${fetched.queue[0].voteSkips.length}/${required} required.`);
+ if (fetched.queue[0].voteSkips.includes(message.member.id)) return message.reply(`Sorry, you have already voted to skip! ${fetched.queue[0].voteSkips.length}/${required} required.`);
- fetched.queue[0].voteSkips.push(message.member.id);
+ fetched.queue[0].voteSkips.push(message.member.id);
- ops.active.set(message.guild.id, fetched);
+ ops.active.set(message.guild.id, fetched);
- if (fetched.queue[0].voteSkips.length >= required) {
- message.channel.send('Successfully skipped song!');
+ if (fetched.queue[0].voteSkips.length >= required) {
+ message.channel.send('Successfully skipped song!');
- return fetched.dispatcher.emit('finish');
- }
+ return fetched.dispatcher.emit('finish');
+ }
- message.channel.send(`Successfully voted to skip! ${fetched.queue[0].voteSkips.length}/${required} required.`);
+ message.channel.send(`Successfully voted to skip! ${fetched.queue[0].voteSkips.length}/${required} required.`);
};
exports.conf = {
- aliases: [],
- guildOnly: false,
+ aliases: [],
+ guildOnly: false,
};
exports.help = {
- name: 'skip',
- description: 'Skips a music.',
- usage: 'skip',
- category: '- Music Commands',
+ name: 'skip',
+ description: 'Skips a music.',
+ usage: 'skip',
+ category: '- Music Commands',
};