Refactor track recommendation logic and add TrackRecType enum

Moved recommendation query generation from Node to Track using the new TrackRecType enum, simplifying and centralizing platform-specific recommendation formatting. Updated related methods to use Track.get_recommendations, removed Node.get_recommendations, and improved enum handling for search platform matching. Also exposed TrackRecType in voicelink.__init__.
This commit is contained in:
Choco
2025-10-09 11:12:02 +08:00
parent c28f17ea43
commit df5373353c
8 changed files with 114 additions and 35 deletions

View File

@@ -226,7 +226,7 @@ class Basic(commands.Cog):
if url(query):
return await send_localized_message(ctx, "search.noLinkSupport", ephemeral=True)
search_type: voicelink.SearchType = voicelink.SearchType.match(platform) or Config().search_platform
search_type: voicelink.SearchType = voicelink.SearchType.from_platform(platform) or Config().search_platform
tracks = await player.get_tracks(query=query, requester=ctx.author, search_type=search_type)
if not tracks:
return await send_localized_message(ctx, "player.errors.noTrackFound")