1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-06-16 18:56:00 +00:00

More powerful number handling. Setting whether to announce songs starting to play. Remove command fixes

This commit is contained in:
MatteZ02
2019-10-24 20:11:08 +03:00
parent bd9ef87dde
commit 38c0103281
10 changed files with 75 additions and 35 deletions

View File

@ -29,7 +29,7 @@ module.exports = async function (video, message, voiceChannel, client, playlist
try {
var connection = await voiceChannel.join();
construct.connection = connection;
client.funcs.play(message.guild, construct.songs[0], client, message, 0);
client.funcs.play(message.guild, construct.songs[0], client, message, 0, true);
} catch (error) {
client.queue.delete(message.guild.id);
client.channels.get('634718645188034560').send("Error with connecting to voice channel: " + error);

View File

@ -1,4 +1,4 @@
module.exports = async function (guild, song, client, message, seek) {
module.exports = async function (guild, song, client, message, seek, play) {
const Discord = require('discord.js');
const ytdl = require('ytdl-core');
const serverQueue = client.queue.get(guild.id);
@ -25,11 +25,13 @@ module.exports = async function (guild, song, client, message, seek) {
});
dispatcher.setVolume(serverQueue.volume / 10);
dispatcher.on("error", error => console.error(error));
let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url));
let songtime = (data.length_seconds * 1000).toFixed(0);
const embed = new Discord.RichEmbed()
.setTitle(`:musical_note: Start playing: **${song.title}**`)
.setDescription(`Song duration: \`${client.funcs.msToTime(songtime)}\``)
.setColor("#b50002")
serverQueue.textChannel.send(embed);
if (client.global.db.guilds[guild.id].startPlaying || play) {
let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url));
let songtime = (data.length_seconds * 1000).toFixed(0);
const embed = new Discord.RichEmbed()
.setTitle(`:musical_note: Start playing: **${song.title}**`)
.setDescription(`Song duration: \`${client.funcs.msToTime(songtime)}\``)
.setColor("#b50002")
serverQueue.textChannel.send(embed);
}
}