mirror of
https://github.com/musix-org/musix-oss
synced 2024-12-23 06:43:17 +00:00
Update play.js
This commit is contained in:
parent
1643abd605
commit
9821119f3d
@ -3,6 +3,7 @@ module.exports = async function (guild, song, client, message, seek) {
|
|||||||
const ytdl = require('ytdl-core');
|
const ytdl = require('ytdl-core');
|
||||||
const serverQueue = client.queue.get(guild.id);
|
const serverQueue = client.queue.get(guild.id);
|
||||||
if (!song) {
|
if (!song) {
|
||||||
|
console.log("no song")
|
||||||
serverQueue.voiceChannel.leave();
|
serverQueue.voiceChannel.leave();
|
||||||
client.queue.delete(guild.id);
|
client.queue.delete(guild.id);
|
||||||
return;
|
return;
|
||||||
@ -23,13 +24,17 @@ module.exports = async function (guild, song, client, message, seek) {
|
|||||||
serverQueue.songs.shift();
|
serverQueue.songs.shift();
|
||||||
client.funcs.play(guild, serverQueue.songs[0], client, message);
|
client.funcs.play(guild, serverQueue.songs[0], client, message);
|
||||||
});
|
});
|
||||||
|
console.log("settings volume")
|
||||||
dispatcher.setVolume(serverQueue.volume / 10);
|
dispatcher.setVolume(serverQueue.volume / 10);
|
||||||
dispatcher.on("error", error => console.error(error));
|
dispatcher.on("error", error => console.error(error));
|
||||||
|
console.log("defining data & songtime")
|
||||||
let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url));
|
let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url));
|
||||||
let songtime = (data.length_seconds * 1000).toFixed(0);
|
let songtime = (data.length_seconds * 1000).toFixed(0);
|
||||||
|
console.log("defining embed")
|
||||||
const embed = new Discord.RichEmbed()
|
const embed = new Discord.RichEmbed()
|
||||||
.setTitle(`:musical_note: Start playing: **${song.title}**`)
|
.setTitle(`:musical_note: Start playing: **${song.title}**`)
|
||||||
.setDescription(`Song duration: \`${client.funcs.msToTime(songtime)}\``)
|
.setDescription(`Song duration: \`${client.funcs.msToTime(songtime)}\``)
|
||||||
.setColor("#b50002")
|
.setColor("#b50002")
|
||||||
|
console.log("sending embed")
|
||||||
serverQueue.textChannel.send(embed);
|
serverQueue.textChannel.send(embed);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user