Skip to content

Commit cfa9f9a

Browse files
authored
Fix example in 'Component callbacks' section (#239)
The function in the example had a parameter called button_context, but ctx was used instead inside the defined function, so I replaced button_context with ctx.
1 parent 9616347 commit cfa9f9a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/components.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ Let's register our callback function via decorator :meth:`component_callback() <
9797
.. code-block:: python
9898
9999
@slash.component_callback()
100-
async def hello(button_context: ComponentContext):
100+
async def hello(ctx: ComponentContext):
101101
await ctx.edit_origin(content="You pressed a button!")
102102
103103
In this example, :func:`hello` will be triggered when you receive interaction event from a component with a `custom_id` set to `"hello"`. Just like slash commands, the callback's `custom_id` defaults to the function name.

0 commit comments

Comments
 (0)