Merge pull request #40 from ChocoMeow/beta

Beta
This commit is contained in:
Choco
2024-10-25 16:57:29 +08:00
committed by GitHub
3 changed files with 5 additions and 5 deletions

View File

@@ -92,7 +92,7 @@ class Basic(commands.Cog):
return [app_commands.Choice(name=c.capitalize(), value=c) for c in self.bot.cogs if c not in ["Nodes", "Task"] and current in c]
async def play_autocomplete(self, interaction: discord.Interaction, current: str) -> list:
if voicelink.pool.URL_REGEX.match(current): return []
if voicelink.pool.URL_REGEX.match(current): return [app_commands.Choice(name=current, value=current)]
history: dict[str, str] = {}
for track_id in reversed(await get_user(interaction.user.id, "history")):
@@ -107,9 +107,9 @@ class Basic(commands.Cog):
if node and node.spotify_client:
try:
tracks: list[voicelink.Track] = await node.spotifySearch(current, requester=interaction.user)
return history_tracks[:5] + [app_commands.Choice(name=truncate_string(f"🎵 {track.author} - {track.title}", 100), value=truncate_string(f"{track.author} - {track.title}", 100)) for track in tracks]
return [app_commands.Choice(name=truncate_string(f"🎵 {track.author} - {track.title}", 100), value=truncate_string(f"{track.author} - {track.title}", 100)) for track in tracks]
except voicelink.TrackLoadError:
return history_tracks
return []
@commands.hybrid_command(name="connect", aliases=get_aliases("connect"))
@app_commands.describe(channel="Provide a channel to connect.")

View File

@@ -515,7 +515,7 @@ class Node:
)
for track in tracks ]
async def get_recommendations(self, track: Track, limit: int = None) -> List[Optional[Track]]:
async def get_recommendations(self, track: Track, limit: int = 20) -> List[Optional[Track]]:
if track.spotify:
if not self.spotify_client:
return []

View File

@@ -91,7 +91,7 @@ class Client:
data = await self.get_request(request_url)
return [ Track(track) for track in data['tracks']['items'] ]
async def similar_track(self, seed_tracks: str, *, limit: int = 5) -> List[Track]:
async def similar_track(self, seed_tracks: str, *, limit: int = 10) -> List[Track]:
request_url = SUGGESTION_URL.format(limit=limit, seed_tracks=seed_tracks)
data = await self.get_request(request_url)
return [ Track(track) for track in data['tracks'] ]