Compare commits
2 commits
ad141377e7
...
28481c2775
Author | SHA1 | Date | |
---|---|---|---|
28481c2775 | |||
e0b46409f9 |
1 changed files with 12 additions and 6 deletions
|
@ -213,7 +213,13 @@ async function enqueue({
|
||||||
].url
|
].url
|
||||||
.replace("vi_webp", "vi")
|
.replace("vi_webp", "vi")
|
||||||
.replace(".webp", ".jpg");
|
.replace(".webp", ".jpg");
|
||||||
media = {url: info?.format.sort((a, b) => b.bitrate - a.bitrate)[0].url};
|
|
||||||
|
const formats = info?.format;
|
||||||
|
let url;
|
||||||
|
if (formats) {
|
||||||
|
formats.sort((a, b) => b.bitrate - a.bitrate);
|
||||||
|
media = formats[0].url;
|
||||||
|
}
|
||||||
} else if (type == "sc") {
|
} else if (type == "sc") {
|
||||||
if (url?.startsWith("sc:"))
|
if (url?.startsWith("sc:"))
|
||||||
url = url.replace(/^sc:/, "https://soundcloud.com/");
|
url = url.replace(/^sc:/, "https://soundcloud.com/");
|
||||||
|
@ -233,7 +239,7 @@ async function enqueue({
|
||||||
title = info.title;
|
title = info.title;
|
||||||
length = info.duration;
|
length = info.duration;
|
||||||
thumbnail = info.artwork_url;
|
thumbnail = info.artwork_url;
|
||||||
media = {stream: streamUrl};
|
media = streamUrl;
|
||||||
} else if (type == "file") {
|
} else if (type == "file") {
|
||||||
title = url;
|
title = url;
|
||||||
let info;
|
let info;
|
||||||
|
@ -259,7 +265,7 @@ async function enqueue({
|
||||||
}
|
}
|
||||||
|
|
||||||
length = info.duration ? Math.floor(info.duration) * 1000 : 0;
|
length = info.duration ? Math.floor(info.duration) * 1000 : 0;
|
||||||
media = {stream: url};
|
media = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connection.connection.playing) {
|
if (connection.connection.playing) {
|
||||||
|
@ -290,7 +296,7 @@ async function enqueue({
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: "Title",
|
name: "Title",
|
||||||
value: title && title != url ? `[${title}](${url})` : url,
|
value: (title && title != url ? `[${title}](${url})` : url).substring(0, 1024),
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -323,7 +329,7 @@ async function enqueue({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await connection.connection.play(media.stream, {
|
await connection.connection.play(media, {
|
||||||
inlineVolume: true,
|
inlineVolume: true,
|
||||||
voiceDataTimeout: -1,
|
voiceDataTimeout: -1,
|
||||||
});
|
});
|
||||||
|
@ -336,7 +342,7 @@ async function enqueue({
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: "Title",
|
name: "Title",
|
||||||
value: title ? `[${title}](${url})` : url,
|
value: (title ? `[${title}](${url})` : url).substring(0, 1024),
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue