Skip to content

Commit 4c348d0

Browse files
committed
feat(docs) fixed some note boxes
1 parent 109de84 commit 4c348d0

File tree

1 file changed

+28
-10
lines changed

1 file changed

+28
-10
lines changed

discord/ext/commands/cog.py

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,11 @@ def on_click(cls, custom_id: Optional[Union[Pattern[AnyStr], AnyStr]] = None) ->
342342
A decorator that registers a raw_button_click event that checks on execution if the ``custom_id's`` are the same;
343343
if so, the :func:`func` is called.
344344
345-
The function this is attached to must take the same parameters as a
346-
:func:`on_raw_button_click` event.
347-
348345
.. 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::
349350
The func must be a coroutine, if not, :exc:`TypeError` is raised.
350351
351352
Parameters
@@ -355,6 +356,11 @@ def on_click(cls, custom_id: Optional[Union[Pattern[AnyStr], AnyStr]] = None) ->
355356
or you want to give the function a different name then the custom_id use this one to set the custom_id.
356357
You can also specify a regex and if the custom_id matches it, the function will be executed.
357358
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+
358364
Example
359365
-------
360366
.. code-block:: python3
@@ -396,12 +402,13 @@ def on_select(cls, custom_id: Optional[Union[Pattern[AnyStr], AnyStr]] = None) -
396402
[Awaitable[Any]], Awaitable[Any]
397403
]:
398404
"""
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).
403406
404407
.. 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::
405412
The func must be a coroutine, if not, :exc:`TypeError` is raised.
406413
407414
Parameters
@@ -411,6 +418,11 @@ def on_select(cls, custom_id: Optional[Union[Pattern[AnyStr], AnyStr]] = None) -
411418
or you want to give the function a different name then the custom_id use this one to set the custom_id.
412419
You can also specify a regex and if the custom_id matches it, the function will be executed.
413420
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+
414426
Example
415427
-------
416428
@@ -459,10 +471,11 @@ def on_submit(self, custom_id: Optional[Union[Pattern[AnyStr], AnyStr]] = None)
459471
A decorator that registers an :attr:`on_modal_submit` event that checks on execution if the ``custom_id's`` are the same;
460472
if so, the :func:`func` is called.
461473
462-
The function this is attached to must take the same parameters as a
463-
:func:`on_modal_submit`.
464-
465474
.. 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::
466479
The func must be a coroutine, if not, :exc:`TypeError` is raised.
467480
468481
Parameters
@@ -472,6 +485,11 @@ def on_submit(self, custom_id: Optional[Union[Pattern[AnyStr], AnyStr]] = None)
472485
or you want to give the function a different name then the custom_id use this one to set the custom_id.
473486
You can also specify a regex and if the custom_id matches it, the function will be executed.
474487
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+
475493
Example
476494
-------
477495
.. code-block:: python

0 commit comments

Comments
 (0)