From 2f2b551ea83a71b4ffbfdbeaf70e596aebe0d058 Mon Sep 17 00:00:00 2001 From: MatteZ02 <47610069+MatteZ02@users.noreply.github.com> Date: Sat, 12 Oct 2019 10:22:00 +0300 Subject: [PATCH] Added ffmpeg --- funcs/play.js | 19 +++++++------------ package-lock.json | 5 +++++ package.json | 1 + 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/funcs/play.js b/funcs/play.js index bf5be0e3..e89bfbd8 100644 --- a/funcs/play.js +++ b/funcs/play.js @@ -3,7 +3,6 @@ module.exports = async function (guild, song, client, message, seek) { const ytdl = require('ytdl-core'); const serverQueue = client.queue.get(guild.id); if (!song) { - console.log("no song") serverQueue.voiceChannel.leave(); client.queue.delete(guild.id); return; @@ -24,17 +23,13 @@ module.exports = async function (guild, song, client, message, seek) { serverQueue.songs.shift(); client.funcs.play(guild, serverQueue.songs[0], client, message); }); - console.log("settings volume") dispatcher.setVolume(serverQueue.volume / 10); dispatcher.on("error", error => console.error(error)); - console.log("defining data & songtime") - //let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url)); - //let songtime = (data.length_seconds * 1000).toFixed(0); - console.log("defining embed") - //const embed = new Discord.RichEmbed() - //.setTitle(`:musical_note: Start playing: **${song.title}**`) - //.setDescription(`Song duration: \`${client.funcs.msToTime(songtime)}\``) - //.setColor("#b50002") - console.log("sending embed") - serverQueue.textChannel.send("Playing"); + 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); } diff --git a/package-lock.json b/package-lock.json index cbf5d8c4..b563a0f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -898,6 +898,11 @@ "when": ">= 0.0.1" } }, + "ffmpeg-static": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/ffmpeg-static/-/ffmpeg-static-2.7.0.tgz", + "integrity": "sha512-Khjg/4tCBen58ixhXlkRNqs3hUKpTOlGOUrw859M09tdjeMkXyXRQ+YuJjGczRhGO7Y8fHPJZcQ37V/OzvZvjQ==" + }, "firebase": { "version": "6.6.2", "resolved": "https://registry.npmjs.org/firebase/-/firebase-6.6.2.tgz", diff --git a/package.json b/package.json index 365c2d59..9a71cfd4 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "discord.js": "^11.5.1", "dotenv": "^8.1.0", "ffmpeg": "0.0.4", + "ffmpeg-static": "^2.7.0", "firebase": "^6.6.2", "firebase-admin": "^8.6.0", "fs": "0.0.1-security",