File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -262,20 +262,23 @@ from interactions import AutocompleteContext
262262
263263@my_command.autocomplete (" string_option" )
264264async def autocomplete (self , ctx : AutocompleteContext):
265- # make sure this is done within three seconds
265+ string_option_input = ctx.input_text # can be empty
266+ # you can use ctx.kwargs.get("name") for other options - note they can be empty too
267+
268+ # make sure you respond within three seconds
266269 await ctx.send(
267270 choices = [
268271 {
269- " name" : f " { ctx.input_text } a " ,
270- " value" : f " { ctx.input_text } a " ,
272+ " name" : f " { string_option_input } a " ,
273+ " value" : f " { string_option_input } a " ,
271274 },
272275 {
273- " name" : f " { ctx.input_text } b " ,
274- " value" : f " { ctx.input_text } b " ,
276+ " name" : f " { string_option_input } b " ,
277+ " value" : f " { string_option_input } b " ,
275278 },
276279 {
277- " name" : f " { ctx.input_text } c " ,
278- " value" : f " { ctx.input_text } c " ,
280+ " name" : f " { string_option_input } c " ,
281+ " value" : f " { string_option_input } c " ,
279282 },
280283 ]
281284 )
You can’t perform that action at this time.
0 commit comments