aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-01-25 01:53:35 -0500
committerRapptz <[email protected]>2016-01-25 01:55:31 -0500
commit8b1854e759a28a1ecd84bdc80f5a50722fb9f2db (patch)
tree665ea7034a766efa7f0ec137473e1ff6a31a1c3f /docs
parentHTTPException now has a text attribute if JSON is not available. (diff)
downloaddiscord.py-8b1854e759a28a1ecd84bdc80f5a50722fb9f2db.tar.xz
discord.py-8b1854e759a28a1ecd84bdc80f5a50722fb9f2db.zip
Add and remove some of the on_socket_* events.
on_socket_raw_receive and on_socket_raw_send were added back in an odd way. The rest of them such as on_socket_closed, on_socket_opened, and on_socket_receive were removed.
Diffstat (limited to 'docs')
-rw-r--r--docs/api.rst60
-rw-r--r--docs/migrating.rst4
2 files changed, 20 insertions, 44 deletions
diff --git a/docs/api.rst b/docs/api.rst
index 81ddc76b..d541ba81 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -133,67 +133,41 @@ to handle it, which defaults to print a traceback and ignore the exception.
:param message: A :class:`Message` of the current message.
-.. function:: on_socket_opened()
-
- Called whenever the websocket is successfully opened. This is not the same thing as being ready.
- For that, use :func:`on_ready`.
-
-.. function:: on_socket_closed()
-
- Called whenever the websocket is closed, through an error or otherwise.
-
-.. function:: on_socket_update(event, data)
-
- Called whenever a recognised websocket event is found. This function would normally be not be
- called as there are higher level events in the library such as :func:`on_message`.
-
- :param str event: The string of the event received. e.g. ``READY``.
- :param data: The data associated with the socket event. Usually a ``dict``.
-
-.. function:: on_socket_response(response)
-
- Called whenever a message is received from the websocket. Used mainly for debugging purposes.
- The parameter passed is raw data that was parsed via ``json.loads``. Note that this is called
- before the :class:`Client` processes the event.
-
- :param response: The received message response after gone through ``json.loads``.
-
.. function:: on_socket_raw_receive(msg)
Called whenever a message is received from the websocket, before
- it's processed. Unlike ``on_socket_response`` this event is always
- dispatched when a message is received and the passed data is not
- processed in any way.
+ it's processed.This event is always dispatched when a message is
+ received and the passed data is not processed in any way.
- This is only really useful for grabing the websocket stream and
+ This is only really useful for grabbing the websocket stream and
debugging purposes.
- :param msg: The message passed on from the ws4py library. Can be an
- instance of either ws4py.messaging.TextMessage, or
- ws4py.messaging.BinaryMessage.
+ .. note::
+
+ This is only for the messages received from the client
+ websocket. The voice websocket will not trigger this event.
+
+ :param msg: The message passed in from the websocket library.
+ Could be ``bytes`` for a binary message or ``str``
+ for a regular message.
-.. function:: on_socket_raw_send(payload, binary=False)
+.. function:: on_socket_raw_send(payload)
Called whenever a send operation is done on the websocket before the
message is sent. The passed parameter is the message that is to
sent to the websocket.
- This is only really useful for grabing the websocket stream and
+ This is only really useful for grabbing the websocket stream and
debugging purposes.
.. note::
- If the ``payload`` parameter is mutable, and modified during the
- execution of this event, then the actual data sent out on the
- websocket will be mangled. This is especially true if
- ``payload`` is a generator, as reading them modifies their
- state.
+ This is only for the messages received from the client
+ websocket. The voice websocket will not trigger this event.
:param payload: The message that is about to be passed on to the
- ws4py library. It can be any of a string, a bytearray, an
- instance of ws4py.message.Message and a generator.
- :param bool binary: True if the message being sent out is marked as
- binary.
+ websocket library. It can be ``bytes`` to denote a binary
+ message or ``str`` to denote a regular text message.
.. function:: on_message_delete(message)
on_message_edit(before, after)
diff --git a/docs/migrating.rst b/docs/migrating.rst
index 2b60cb2b..5e909e0f 100644
--- a/docs/migrating.rst
+++ b/docs/migrating.rst
@@ -79,6 +79,7 @@ Before:
def on_status(member): pass
def on_server_role_update(role): pass
def on_voice_state_update(member): pass
+ def on_socket_raw_send(payload, is_binary): pass
After:
@@ -89,9 +90,10 @@ After:
def on_member_update(before, after): pass
def on_server_role_update(before, after): pass
def on_voice_state_update(before, after): pass
+ def on_socket_raw_send(payload): pass
Note that ``on_status`` was removed. If you want its functionality, use :func:`on_member_update`.
-See :ref:`discord-api-events` for more information.
+See :ref:`discord-api-events` for more information. Other removed events include ``on_socket_closed``, ``on_socket_receive``, and ``on_socket_opened``.
.. _migrating-coroutines: