Skip to content
Discussion options

You must be logged in to vote
class CogName(commands.cog):
    ....

    async def get_all_parts(self, interaction, current):
        await interaction.response.defer()
        choices = []
        finalchoices = []
        partType = interaction.namespace.part_type
        for part in partTypeData["options"]:
            choices.append(part)

        for choice in choices:
            if current.lower() in choice.lower():
                finalchoices.append(app_commands.Choice(name=choice, value=choice))
        return finalchoices
        
    @app_commands.command()
    @app_commands.autocomplete(part_type=get_part_types, part_name=get_all_parts)
    async def command(self, interaction, part_type:str, part_name:str):

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@aurkaxi
Comment options

@ElBe-Plaq
Comment options

@aurkaxi
Comment options

@ElBe-Plaq
Comment options

@aurkaxi
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by aurkaxi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants