From 74fa8da4eb66af37f5f9650aa3d46856df574391 Mon Sep 17 00:00:00 2001 From: NoLogicAlan Date: Fri, 4 Sep 2026 03:28:20 +0300 Subject: [PATCH] ...test --- commands/autoplay.mjs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/commands/autoplay.mjs b/commands/autoplay.mjs index 5d00413..b2cd1e9 100644 --- a/commands/autoplay.mjs +++ b/commands/autoplay.mjs @@ -166,16 +166,6 @@ async function pickAutoplayTrack(p, ctx, lastTrack) { p._autoplayPreferredPoolVid = videoId; return cached; } - - try { - const mixUrl = `https://www.youtube.com/watch?v=${videoId}&list=RD${videoId}`; - const candidates = await resolveCandidates(p, mixUrl, "yt"); - if (candidates.length) { - storePool(p, videoId, candidates); - p._autoplayPreferredPoolVid = videoId; - return candidates[Math.floor(Math.random() * Math.min(PICK_POOL, candidates.length))]; - } - } catch (e) { logger.warn("[Autoplay] Mix strategy failed:", e?.message); } } const lf = ctx?.lastfm; @@ -212,6 +202,18 @@ async function pickAutoplayTrack(p, ctx, lastTrack) { } catch (_) {} } + if (videoId) { + try { + const mixUrl = `https://www.youtube.com/watch?v=${videoId}&list=RD${videoId}`; + const candidates = await resolveCandidates(p, mixUrl, "yt"); + if (candidates.length) { + storePool(p, videoId, candidates); + p._autoplayPreferredPoolVid = videoId; + return candidates[Math.floor(Math.random() * Math.min(PICK_POOL, candidates.length))]; + } + } catch (e) { logger.warn("[Autoplay] Mix strategy failed:", e?.message); } + } + return null; }