aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2015-09-03 19:49:51 -0400
committerRapptz <[email protected]>2015-09-03 19:49:51 -0400
commit9deb743df3dbe0dec1d2551c1c008e2e025c4e5a (patch)
treea85e76ab865446d18a69f0874326c7ca2650cb26
parentUpdate README. (diff)
downloaddiscord.py-9deb743df3dbe0dec1d2551c1c008e2e025c4e5a.tar.xz
discord.py-9deb743df3dbe0dec1d2551c1c008e2e025c4e5a.zip
Store email in the client as an attribute.
-rw-r--r--discord/client.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/discord/client.py b/discord/client.py
index 173928da..86374bb5 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