Replies: 2 comments 5 replies
-
|
Does it work if you use |
Beta Was this translation helpful? Give feedback.
5 replies
-
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): |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
aurkaxi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
There are 2 boxes, they contain:
box(x) { a, b
box(y) { c, d
there is a function(g):
async def function_g(self, interaction):which returns the name of box x and yanother funtion(h): `async def function_h(self, interaction, in_box): which returns the items of the selected box
so if the decorator goes like
@app_commands.autocomplete(box=function_g, items= function_h(in_box=selectedbox)now what do i write for
in_boxparameter in the decorator. (theselectedbox). I need the value ofboxbefore the interaction invokes.Beta Was this translation helpful? Give feedback.
All reactions