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

@@ -152,7 +152,7 @@ async def getRecommendation(bot: commands.Bot, data: Dict) -> None:
track_data = Track.decode(track_id := data.get("trackId"))
track = Track(track_id=track_id, info=track_data, requester=bot.user)
tracks: List[Track] = await node.get_recommendations(track, limit=60)
tracks: List[Track] = await track.get_recommendations(node)
return {
"op": "getRecommendation",