Skip to content

Commit 69659ca

Browse files
committed
docs: update autocomplete
1 parent 91c4262 commit 69659ca

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/src/Guides/03 Creating Commands.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,21 +231,21 @@ Then you need to register the autocomplete callback, aka the function Discord ca
231231
In there, you have three seconds to return whatever choices you want to the user. In this example we will simply return their input with "a", "b" or "c" appended:
232232
```python
233233
@my_command.autocomplete("string_option")
234-
async def autocomplete(self, ctx: AutocompleteContext, string_option: str):
234+
async def autocomplete(self, ctx: AutocompleteContext):
235235
# make sure this is done within three seconds
236236
await ctx.send(
237237
choices=[
238238
{
239-
"name": f"{string_option}a",
240-
"value": f"{string_option}a",
239+
"name": f"{ctx.input_text}a",
240+
"value": f"{ctx.input_text}a",
241241
},
242242
{
243-
"name": f"{string_option}b",
244-
"value": f"{string_option}b",
243+
"name": f"{ctx.input_text}b",
244+
"value": f"{ctx.input_text}b",
245245
},
246246
{
247-
"name": f"{string_option}c",
248-
"value": f"{string_option}c",
247+
"name": f"{ctx.input_text}c",
248+
"value": f"{ctx.input_text}c",
249249
},
250250
]
251251
)

0 commit comments

Comments
 (0)