Skip to content

Commit

Permalink
docs: remove @client.once() (#2073)
Browse files Browse the repository at this point in the history
Update events.rst

Signed-off-by: Om <92863779+Om1609@users.noreply.github.com>
Co-authored-by: Lala Sabathil <lala@pycord.dev>
  • Loading branch information
OmLanke and Lulalaby committed May 14, 2023
1 parent 3babb79 commit 6a69f66
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/api/events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ Event Reference

This section outlines the different types of events listened by :class:`Client`.

There are 4 ways to register an event, the first way is through the use of
There are 3 ways to register an event, the first way is through the use of
:meth:`Client.event`. The second way is through subclassing :class:`Client` and
overriding the specific events. The third way is through the use of :meth:`Client.listen`,
which can be used to assign multiple event handlers instead of only one like in :meth:`Client.event`.
The fourth way is through the use of :meth:`Client.once`, which serves as a one-time event listener. For example:
For example:

.. code-block:: python
:emphasize-lines: 17, 22
Expand Down Expand Up @@ -41,10 +41,10 @@ The fourth way is through the use of :meth:`Client.once`, which serves as a one-
async def on_message(message: discord.Message):
print(f"Received {message.content}")
# Runs only for the 1st 'on_message' event. Can be useful for listening to 'on_ready'
@client.once()
async def message(message: discord.Message):
print(f"Received {message.content}")
# Runs only for the 1st event dispatch. Can be useful for listening to 'on_ready'
@client.listen(once=True)
async def on_ready():
print("Client is ready!")
If an event handler raises an exception, :func:`on_error` will be called
Expand Down

0 comments on commit 6a69f66

Please sign in to comment.