1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-23 03:33:17 +00:00

Update index.js

This commit is contained in:
MatteZ02 2019-07-23 18:06:48 +03:00
parent cb10d308a0
commit b55e4f25ce

View File

@ -84,8 +84,8 @@ client.on('message', async msg => {
const playlist = await youtube.getPlaylist(url); const playlist = await youtube.getPlaylist(url);
const videos = await playlist.getVideos(); const videos = await playlist.getVideos();
for (const video of Object.values(videos)) { for (const video of Object.values(videos)) {
const video2 = await youtube.getVideoByID(video.id); // eslint-disable-line no-await-in-loop const video2 = await youtube.getVideoByID(video.id);
await handleVideo(video2, msg, voiceChannel, true); // eslint-disable-line no-await-in-loop await handleVideo(video2, msg, voiceChannel, true);
} }
return msg.channel.send(`:white_check_mark: Playlist: **${playlist.title}** has been added to the queue!`); return msg.channel.send(`:white_check_mark: Playlist: **${playlist.title}** has been added to the queue!`);
} else { } else {
@ -122,13 +122,13 @@ Please provide a value to select one of the search results ranging from __1-10__
if (!serverQueue) return msg.channel.send(':x: There is nothing playing that I could skip for you.'); if (!serverQueue) return msg.channel.send(':x: There is nothing playing that I could skip for you.');
if (!serverQueue.songs[1]) return msg.channel.send(':x: Theres nothing to skip to!') if (!serverQueue.songs[1]) return msg.channel.send(':x: Theres nothing to skip to!')
serverQueue.connection.dispatcher.end('Skipped'); serverQueue.connection.dispatcher.end('Skipped');
return undefined; return;
} else if (command === 'stop') { } else if (command === 'stop') {
if (!msg.member.voiceChannel) return msg.channel.send(':x: You are not in a voice channel!'); if (!msg.member.voiceChannel) return msg.channel.send(':x: You are not in a voice channel!');
if (!serverQueue) return msg.channel.send(':x: There is nothing playing that I could stop for you.'); if (!serverQueue) return msg.channel.send(':x: There is nothing playing that I could stop for you.');
serverQueue.songs = []; serverQueue.songs = [];
serverQueue.connection.dispatcher.end('Stopped!'); serverQueue.connection.dispatcher.end('Stopped!');
return undefined; return;
} else if (command === 'volume') { } else if (command === 'volume') {
if (!msg.member.voiceChannel) return msg.channel.send(':x: You are not in a voice channel!'); if (!msg.member.voiceChannel) return msg.channel.send(':x: You are not in a voice channel!');
if (!serverQueue) return msg.channel.send(':x: There is nothing playing.'); if (!serverQueue) return msg.channel.send(':x: There is nothing playing.');
@ -169,7 +169,7 @@ ${serverQueue.songs.map(song => `**-** ${song.title}`).join("\n")}
} }
if (msg.content === `${PREFIX}`) return; if (msg.content === `${PREFIX}`) return;
msg.channel.send(':x: Unknown command! Type -help for the list of commands!') msg.channel.send(':x: Unknown command! Type -help for the list of commands!')
return undefined; return;
} }
if (msg.content === `${PREFIX}`) return; if (msg.content === `${PREFIX}`) return;
var coms = ['-play', '-queue', '-np', '-volume', '-pause', '-resume', '-stop', '-skip', '-ping'] var coms = ['-play', '-queue', '-np', '-volume', '-pause', '-resume', '-stop', '-skip', '-ping']
@ -273,8 +273,8 @@ Please provide a value to select one of the search results ranging from 1-10.
if (!serverQueue) if (!serverQueue)
return msg.channel.send(":x: There is nothing in the queue."); return msg.channel.send(":x: There is nothing in the queue.");
var queuemessage = `__**Song queue:**__ var queuemessage = `__**Song queue:**__
${serverQueue.songs.map(song => `**-** ${song.title}`).join("\n")} ${serverQueue.songs.map(song => `**-** ${song.title}`).join("\n")}
**Now playing:** ${serverQueue.songs[0].title} :musical_note: `; **Now playing:** ${serverQueue.songs[0].title} :musical_note: `;
if (queuemessage.length < 2000) { if (queuemessage.length < 2000) {
return msg.channel.send(":x: The queue has too many songs in it to show all in this channel. Try again after a few songs"); return msg.channel.send(":x: The queue has too many songs in it to show all in this channel. Try again after a few songs");
} }
@ -296,10 +296,10 @@ Please provide a value to select one of the search results ranging from 1-10.
} }
} }
if (msg.content === `${PREFIX}`) { if (msg.content === `${PREFIX}`) {
return undefined; return;
} }
msg.channel.send(':x: Unknown command! Type -help for the list of commands!') msg.channel.send(':x: Unknown command! Type -help for the list of commands!')
return undefined; return;
} }
}); });