Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: remove @client.once() #2073

Merged
merged 2 commits into from
May 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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