fix message and added other links support
This commit is contained in:
@@ -21,11 +21,10 @@ export async function requestSong(
|
||||
url: string,
|
||||
data: Partial<HistoryObject>
|
||||
) {
|
||||
getAudioFile(url).then((path) => {
|
||||
queue.songList.push({ path, url })
|
||||
add_to_history({ url, user: data.user })
|
||||
updatePlayer()
|
||||
})
|
||||
const path = await getAudioFile(url)
|
||||
queue.songList.push({ path, url })
|
||||
add_to_history({ url, user: data.user })
|
||||
await updatePlayer()
|
||||
}
|
||||
|
||||
export async function forceRequestSong(
|
||||
|
||||
@@ -18,8 +18,13 @@ export async function getAudioFile(url: string): Promise<string> {
|
||||
return path
|
||||
}
|
||||
|
||||
function isYTLink(url: string) {
|
||||
return url.startsWith("https://youtube") ||
|
||||
url.startsWith("https://youtu.be");
|
||||
}
|
||||
|
||||
export async function extractId(url: string): Promise<string> {
|
||||
if (url.startsWith("https://soundcloud")) { // soundcloud
|
||||
if (!isYTLink(url)) {
|
||||
const ytDlpBin = process.env.YT_DLP_BIN_PATH! ?? "yt-dlp";
|
||||
return await new Promise<string>((resolve, reject) => {
|
||||
const p = spawn(ytDlpBin, [
|
||||
|
||||
Reference in New Issue
Block a user