music: try readable wrap
This commit is contained in:
parent
07b1b93a3e
commit
96b2a600a8
1 changed files with 6 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
||||||
const {Collection} = require("@projectdysnomia/dysnomia");
|
const {Collection} = require("@projectdysnomia/dysnomia");
|
||||||
|
|
||||||
|
const {Readable} = require("node:stream");
|
||||||
const ffprobe = require("node-ffprobe");
|
const ffprobe = require("node-ffprobe");
|
||||||
|
|
||||||
const Command = require("../lib/command.js");
|
const Command = require("../lib/command.js");
|
||||||
|
@ -230,9 +231,11 @@ async function enqueue({
|
||||||
length = info?.duration * 1000;
|
length = info?.duration * 1000;
|
||||||
thumbnail = info?.thumbnailUrl;
|
thumbnail = info?.thumbnailUrl;
|
||||||
|
|
||||||
media = await fetch(
|
media = Readable.from(
|
||||||
|
await fetch(
|
||||||
info?.audioStreams?.sort((a, b) => a.bitrate - b.bitrate)?.[0]?.url
|
info?.audioStreams?.sort((a, b) => a.bitrate - b.bitrate)?.[0]?.url
|
||||||
).then((res) => res.body);
|
).then((res) => res.body)
|
||||||
|
);
|
||||||
} 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/");
|
||||||
|
|
Loading…
Reference in a new issue