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

Validate url

Validate url for precise song accuracy when using a link to play a song
This commit is contained in:
MatteZ02
2020-04-24 21:35:50 +03:00
parent 6408cbe525
commit cbdc82a655
3 changed files with 103 additions and 88 deletions

View File

@ -60,4 +60,4 @@ module.exports = async function (
return msg.channel.send(client.messages.error);
}
return;
};
};

View File

@ -1,7 +1,5 @@
module.exports = async function (guild, song, client, seek, play) {
const {
Readable: ReadableStream
} = require("stream");
const { Readable: ReadableStream } = require("stream");
const Discord = require("discord.js");
const ytdl = require("ytdl-core");
const streamConfig = require("../config/streamConfig.js");
@ -16,8 +14,7 @@ module.exports = async function (guild, song, client, seek, play) {
streamConfig.options.seek = seek;
let input = song.url;
if (song.type === "ytdl")
input = ytdl(song.url, streamConfig.ytdlOptions);
if (song.type === "ytdl") input = ytdl(song.url, streamConfig.ytdlOptions);
const ffmpegArgs = [
"-analyzeduration",
@ -78,4 +75,4 @@ module.exports = async function (guild, song, client, seek, play) {
queue.textChannel.send(embed);
}
queue.playing = true;
};
};