Fix autocompletion in all slash commands
This commit is contained in:
@@ -74,19 +74,21 @@ class Playlists(commands.Cog, name="playlist"):
|
||||
self.bot = bot
|
||||
self.description = "This is the Vocard playlist system. You can save your favorites and use Vocard to play on any server."
|
||||
|
||||
async def playlist_autocomplete(self, ctx: commands.Context, current: str) -> list:
|
||||
playlists = playlist_name.get(str(ctx.author.id), None)
|
||||
async def playlist_autocomplete(self, interaction: discord.Interaction, current: str) -> list:
|
||||
playlists = playlist_name.get(str(interaction.user.id), None)
|
||||
if not playlists:
|
||||
playlists_raw = await get_playlist(ctx.author.id, 'playlist')
|
||||
playlists = playlist_name[str(ctx.author.id)] = [
|
||||
playlists_raw = await get_playlist(interaction.user.id, 'playlist')
|
||||
playlists = playlist_name[str(interaction.user.id)] = [
|
||||
value['name'] for value in playlists_raw.values()] if playlists_raw else []
|
||||
if current:
|
||||
return [app_commands.Choice(name=p, value=p) for p in playlists if current in p]
|
||||
return [app_commands.Choice(name=p, value=p) for p in playlists]
|
||||
|
||||
@commands.hybrid_group(name="playlist",
|
||||
aliases=get_aliases("playlist"),
|
||||
invoke_without_command=True)
|
||||
@commands.hybrid_group(
|
||||
name="playlist",
|
||||
aliases=get_aliases("playlist"),
|
||||
invoke_without_command=True
|
||||
)
|
||||
async def playlist(self, ctx: commands.Context):
|
||||
view = HelpView(self.bot, ctx.author)
|
||||
embed = view.build_embed(self.qualified_name)
|
||||
|
||||
Reference in New Issue
Block a user