From 9deb743df3dbe0dec1d2551c1c008e2e025c4e5a Mon Sep 17 00:00:00 2001 From: Rapptz Date: Thu, 3 Sep 2015 19:49:51 -0400 Subject: [PATCH] Store email in the client as an attribute. --- discord/client.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/discord/client.py b/discord/client.py index 173928dae..86374bb5a 100644 --- a/discord/client.py +++ b/discord/client.py @@ -76,6 +76,9 @@ class Client(object): .. attribute:: messages A deque_ of :class:`Message` that the client has received from all servers and private messages. + .. attribute:: email + + The email used to login. This is only set if login is successful, otherwise it's None. .. _deque: https://docs.python.org/3.4/library/collections.html#collections.deque """ @@ -83,6 +86,7 @@ class Client(object): def __init__(self, **kwargs): self._is_logged_in = False self.user = None + self.email = None self.servers = [] self.private_channels = [] self.token = '' @@ -451,6 +455,8 @@ class Client(object): r = requests.post(endpoints.LOGIN, json=payload) if r.status_code == 200: + self.email = email + body = r.json() self.token = body['token'] self.headers['authorization'] = self.token