Handle VOICE_STATE_UPDATE websocket events.

This adds a lot of new attributes into the Member class
such as giving a voice_channel that the user is currently connected
to. Initially there was a plan to have a voice_members attribute
in the Channel class but this proved to be difficult when it came to
actually removing users from the voice channel as the response would
return channel_id as null.

Fixes #16.
This commit is contained in:
Rapptz
2015-10-15 01:02:15 -04:00
parent 4ff7d22edd
commit ab2512785b
3 changed files with 54 additions and 3 deletions

View File

@ -174,6 +174,18 @@ to handle it, which defaults to log a traceback and ignore the exception.
:param role: The :class:`Role` that was updated.
.. function:: on_voice_state_update(member)
Called when a :class:`Member` changes their voice state.
The following, but not limited to, examples illustrate when this event is called:
- A member joins a voice room.
- A member leaves a voice room.
- A member is muted or deafened by their own accord.
- A member is muted or deafened by a server administrator.
:param member: The :class:`Member` whose voice state changed.
Utility Functions
-----------------