@@ -342,10 +342,11 @@ def on_click(cls, custom_id: Optional[Union[Pattern[AnyStr], AnyStr]] = None) ->
342
342
A decorator that registers a raw_button_click event that checks on execution if the ``custom_id's`` are the same;
343
343
if so, the :func:`func` is called.
344
344
345
- The function this is attached to must take the same parameters as a
346
- :func:`on_raw_button_click` event.
347
-
348
345
.. important::
346
+ The function this is attached to must take the same parameters as a
347
+ :func:`~discord.on_raw_button_click` event.
348
+
349
+ .. warning::
349
350
The func must be a coroutine, if not, :exc:`TypeError` is raised.
350
351
351
352
Parameters
@@ -355,6 +356,11 @@ def on_click(cls, custom_id: Optional[Union[Pattern[AnyStr], AnyStr]] = None) ->
355
356
or you want to give the function a different name then the custom_id use this one to set the custom_id.
356
357
You can also specify a regex and if the custom_id matches it, the function will be executed.
357
358
359
+ .. note::
360
+ As the :attr:`custom_id` is converted to a :class:`re.Pattern` put ``^`` in front and ``$`` at the end
361
+ of the :attr:`custom_id` if you want that the custom_id must exactly match the specified value.
362
+ Otherwise, something like 'cool blue Button is blue' will let the function bee invoked too.
363
+
358
364
Example
359
365
-------
360
366
.. code-block:: python3
@@ -396,12 +402,13 @@ def on_select(cls, custom_id: Optional[Union[Pattern[AnyStr], AnyStr]] = None) -
396
402
[Awaitable [Any ]], Awaitable [Any ]
397
403
]:
398
404
"""
399
- A decorator with which you can assign a function to a specific :class:`SelectMenu` (or its custom_id).
400
-
401
- The function this is attached to must take the same parameters as a
402
- :func:`on_raw_selection_select` event.
405
+ A decorator with which you can assign a function to a specific :class:`~SelectMenu` (or its custom_id).
403
406
404
407
.. important::
408
+ The function this is attached to must take the same parameters as a
409
+ :func:`~discord.on_raw_selection_select` event.
410
+
411
+ .. warning::
405
412
The func must be a coroutine, if not, :exc:`TypeError` is raised.
406
413
407
414
Parameters
@@ -411,6 +418,11 @@ def on_select(cls, custom_id: Optional[Union[Pattern[AnyStr], AnyStr]] = None) -
411
418
or you want to give the function a different name then the custom_id use this one to set the custom_id.
412
419
You can also specify a regex and if the custom_id matches it, the function will be executed.
413
420
421
+ .. note::
422
+ As the :attr:`custom_id` is converted to a :class:`re.Pattern` put ``^`` in front and ``$`` at the end
423
+ of the :attr:`custom_id` if you want that the custom_id must exactly match the specified value.
424
+ Otherwise, something like 'choose_your_gender later' will let the function bee invoked too.
425
+
414
426
Example
415
427
-------
416
428
@@ -459,10 +471,11 @@ def on_submit(self, custom_id: Optional[Union[Pattern[AnyStr], AnyStr]] = None)
459
471
A decorator that registers an :attr:`on_modal_submit` event that checks on execution if the ``custom_id's`` are the same;
460
472
if so, the :func:`func` is called.
461
473
462
- The function this is attached to must take the same parameters as a
463
- :func:`on_modal_submit`.
464
-
465
474
.. important::
475
+ The function this is attached to must take the same parameters as a
476
+ :func:`~discord.on_modal_submit` event.
477
+
478
+ .. warning::
466
479
The func must be a coroutine, if not, :exc:`TypeError` is raised.
467
480
468
481
Parameters
@@ -472,6 +485,11 @@ def on_submit(self, custom_id: Optional[Union[Pattern[AnyStr], AnyStr]] = None)
472
485
or you want to give the function a different name then the custom_id use this one to set the custom_id.
473
486
You can also specify a regex and if the custom_id matches it, the function will be executed.
474
487
488
+ .. note::
489
+ As the :attr:`custom_id` is converted to a :class:`re.Pattern` put ``^`` in front and ``$`` at the end
490
+ of the :attr:`custom_id` if you want that the custom_id must exactly match the specified value.
491
+ Otherwise, something like 'suggestions_modal_submit_private' will let the function bee invoked too.
492
+
475
493
Example
476
494
-------
477
495
.. code-block:: python
0 commit comments