Skip to content

Commit

Permalink
Merge pull request #40 from ChocoMeow/beta
Browse files Browse the repository at this point in the history
Beta
  • Loading branch information
ChocoMeow authored Oct 25, 2024
2 parents 47eb462 + b26daaa commit 533cb7a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions cogs/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ async def help_autocomplete(self, interaction: discord.Interaction, current: str
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")):
Expand All @@ -107,9 +107,9 @@ async def play_autocomplete(self, interaction: discord.Interaction, current: str
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.")
Expand Down
2 changes: 1 addition & 1 deletion voicelink/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ async def spotifySearch(self, query: str, *, requester: Member) -> Optional[List
)
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 []
Expand Down
2 changes: 1 addition & 1 deletion voicelink/spotify/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async def track_search(self, query: str, track: str = "track", limit: int = 10)
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'] ]
Expand Down

0 comments on commit 533cb7a

Please sign in to comment.