From 307392ff19c5e0a5bddfc67af010d4df52e24db8 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Mon, 30 Nov 2015 03:31:03 -0500 Subject: [PATCH] on_status event now has the old game ID and old status as parameters. --- discord/client.py | 4 +++- docs/api.rst | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/discord/client.py b/discord/client.py index cac3ee0dd..401e4a35f 100644 --- a/discord/client.py +++ b/discord/client.py @@ -206,13 +206,15 @@ class ConnectionState(object): member_id = user['id'] member = utils.find(lambda m: m.id == member_id, server.members) if member is not None: + old_status = copy.copy(member.status) + old_game_id = copy.copy(member.game_id) member.status = data.get('status') member.game_id = data.get('game_id') member.name = user.get('username', member.name) member.avatar = user.get('avatar', member.avatar) # call the event now - self.dispatch('status', member) + self.dispatch('status', member, old_game_id, old_status) self.dispatch('member_update', member) def handle_user_update(self, data): diff --git a/docs/api.rst b/docs/api.rst index 39b96014a..f1e0ec5b1 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -152,11 +152,13 @@ to handle it, which defaults to print a traceback and ignore the exception. :param before: A :class:`Message` of the previous version of the message. :param after: A :class:`Message` of the current version of the message. -.. function:: on_status(member) +.. function:: on_status(member, old_game_id, old_status) Called whenever a :class:`Member` changes their status or game playing status. :param member: The :class:`Member` who has had their status changed. + :param old_game_id: The game ID the member had before it changed. + :param old_status: The status the member had before it changed. .. function:: on_channel_delete(channel) on_channel_create(channel)