1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-22 21:13:18 +00:00
This commit is contained in:
MatteZ02 2020-06-04 13:11:14 +03:00
parent 04858d8a27
commit ba319787a5
6 changed files with 9 additions and 17 deletions

View File

@ -43,7 +43,7 @@
"utf-8-validate": "^5.0.2",
"video-thumbnail-url": "^1.0.1",
"yt-search": "^1.1.2",
"ytdl-core": "^2.1.5",
"ytdl-core": "^3.1.0",
"zlib-sync": "^0.1.6"
}
}

View File

@ -7,12 +7,6 @@ module.exports = {
permission: 'dev',
category: 'util',
async execute(msg, args, client, Discord, command) {
const ytdl = require('ytdl-core');
const queue = client.queue.get(msg.guild.id);
let data;
if (queue) {
data = await Promise.resolve(ytdl.getInfo(queue.songs[0].url));
}
const input = msg.content.slice(client.global.db.guilds[msg.guild.id].prefix.length + 5);
let output;
try {

View File

@ -10,7 +10,7 @@ module.exports = {
const getThumb = require("video-thumbnail-url");
const queue = client.queue.get(msg.guild.id);
if (!queue) return msg.channel.send(client.messages.noServerQueue);
let songTime = (queue.songs[0].length * 1000).toFixed(0);
let songTime = (queue.songs[0].songLength * 1000).toFixed(0);
let completed = (
queue.connection.dispatcher.streamTime + queue.time
).toFixed(0);

View File

@ -26,9 +26,9 @@ module.exports = {
let message;
message = client.messages.seekMax.replace(
"%LENGTH%",
data.length_seconds
data.videoDetails.length_seconds
);
if (pos > data.length_seconds) return msg.channel.send(message);
if (pos > data.videoDetais.length_seconds) return msg.channel.send(message);
}
client.funcs.end(client, msg, pos, command);
}

View File

@ -11,12 +11,12 @@ module.exports = async function (
) {
const songInfo = await ytdl.getInfo(resource.url);
const song = {
title: Discord.Util.escapeMarkdown(songInfo.title),
title: Discord.Util.escapeMarkdown(songInfo.videoDetails.title),
url: resource.url,
author: msg.author,
length: songInfo.length_seconds,
songLength: songInfo.videoDetails.length_seconds,
type: type,
channel: songInfo.author
channel: songInfo.videoDetails.author
};
const queue = client.queue.get(msg.guild.id);

View File

@ -76,12 +76,10 @@ module.exports = async function (guild, song, client, seek, play) {
dispatcher.setVolume(queue.volume / 100);
if ((client.global.db.guilds[guild.id].startPlaying && play) || play) {
if (song.type !== "ytdl") return;
const data = await Promise.resolve(ytdl.getInfo(queue.songs[0].url));
const songtime = (data.length_seconds * 1000).toFixed(0);
const embed = new Discord.MessageEmbed()
.setTitle(`${client.messages.startPlaying}**${song.title}**`)
.setDescription(
`Song duration: \`${client.funcs.msToTime(songtime, "hh:mm:ss")}\``
`Song duration: \`${client.funcs.msToTime(queue.songs[0].songLength, "hh:mm:ss")}\``
)
.setColor(client.config.embedColor);
queue.textChannel.send(embed);