Skip to content

Commit 4f5c22d

Browse files
authored
refactor!: add event to raw_socket_create dispatch (#992)
* refactor!: add ``event`` to ``raw_socket_create`` dispatch * docs: update info about ``raw_socket_create``
1 parent ad70ca0 commit 4f5c22d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

docs/events.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ Event: ``raw_socket_create``
6666
This event fires on any event sent by Discord, including ``Typing Start`` and ``Voice State Update``.
6767
``Hello``, ``Resumed``, ``Reconnect`` and ``Invalid Session`` still will not be dispatched.
6868

69-
The function handling the event should take in one argument, the type of this argument is a ``dict``.
69+
A function handling an event should take two arguments,
70+
the first argument is the name of the event, the second is the data of that event with type ``dict``.
7071

71-
The value of the argument will be the *raw* data sent from Discord, so it is not recommended to use that event
72+
The value of the second argument will be the *raw* data sent from Discord, so it is not recommended to use that event
7273
as long as you don't absolutely need it.
7374

7475

interactions/api/gateway/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def _dispatch_event(self, event: str, data: dict) -> None:
338338
:param data: The data for the event.
339339
:type data: dict
340340
"""
341-
self._dispatch.dispatch("raw_socket_create", data)
341+
self._dispatch.dispatch("raw_socket_create", event, data)
342342
path: str = "interactions"
343343
path += ".models" if event == "INTERACTION_CREATE" else ".api.models"
344344
if event == "INTERACTION_CREATE":

0 commit comments

Comments
 (0)