Add only the track when a link carries both a video and a list
A link copied from an open mix (watch?v=…&list=RD…) expanded into the whole radio station — 500 entries from one paste. Any URL with a `v=` parameter now resolves to that single track, and only a /playlist?list=… URL expands. The rule is deliberately blunt rather than keyed on start_radio, so pasting a link behaves the same way every time. Playlist expansion is also capped separately from the queue limit (MAX_PLAYLIST_TRACKS, 100 by default) and the chat says when a playlist hit that ceiling. Verified against the real yt-dlp: both mix links resolve to one track, a plain video link to one, and a playlist URL to its 13 entries. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
ffcf88efb7
commit
6d65134f8e
+3
-1
@@ -53,8 +53,10 @@ async function playCommand(ctx: CommandContext, mode: "append" | "next" | "now")
|
||||
});
|
||||
|
||||
if (outcome.playlist) {
|
||||
const capped = outcome.tracks.length >= config.MAX_PLAYLIST_TRACKS;
|
||||
await ctx.reply(
|
||||
`📥 Добавлено **${outcome.tracks.length}** треков из плейлиста [${outcome.playlist.title}](${outcome.playlist.url}).`,
|
||||
`📥 Добавлено **${outcome.tracks.length}** треков из плейлиста [${outcome.playlist.title}](${outcome.playlist.url})` +
|
||||
(capped ? ` — это предел на один плейлист (MAX_PLAYLIST_TRACKS).` : "."),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user