From f5413feaf08d3122dc4add4fe2e49de052af818d Mon Sep 17 00:00:00 2001 From: HewkawAr Date: Sun, 18 Aug 2024 06:56:45 +0700 Subject: [PATCH] Fix Search Source --- commands/Music/play.js | 4 ++-- configs/sources.json | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/commands/Music/play.js b/commands/Music/play.js index ba2814a..2dc70e7 100644 --- a/commands/Music/play.js +++ b/commands/Music/play.js @@ -47,7 +47,7 @@ module.exports = { autoPlay: true }); - if (isYouTubeUrl(query)) { + if (isYouTubeUrl(query) || sources[user_source.source].require.includes("YOUTUBE_DIRECT")) { const canDirect = await YoutubeDirectSchema.findOne({ userId: interaction.user.id }); @@ -75,7 +75,7 @@ module.exports = { let res = await client.moon.search({ query, - source: user_source ? sources[user_source.source] : "spsearch", + source: user_source ? sources[user_source.source].source : "spsearch", requester: interaction.user.id }); diff --git a/configs/sources.json b/configs/sources.json index ee25d80..4d852de 100644 --- a/configs/sources.json +++ b/configs/sources.json @@ -1,5 +1,18 @@ { - "spotify": "spsearch", - "youtube": "ytsearch", - "youtube_music": "ytmsearch" + "spotify": { + "source": "spsearch", + "require": [] + }, + "youtube": { + "source": "ytsearch", + "require": [ + "YOUTUBE_DIRECT" + ] + }, + "youtube_music": { + "source": "ytmsearch", + "require": [ + "YOUTUBE_DIRECT" + ] + } } \ No newline at end of file