Browse Source

Fix premium key being missing in profile endpoint.

pull/476/merge
Rapptz 8 years ago
parent
commit
058f1f13eb
  1. 5
      discord/client.py
  2. 5
      discord/user.py

5
discord/client.py

@ -881,9 +881,10 @@ class Client:
def transform(d):
return state._get_guild(int(d['id']))
since = data.get('premium_since')
mutual_guilds = list(filter(None, map(transform, data.get('mutual_guilds', []))))
return Profile(premium=data['premium'],
premium_since=utils.parse_time(data.get('premium_since')),
return Profile(premium=since is not None,
premium_since=utils.parse_time(since),
mutual_guilds=mutual_guilds,
user=User(data=data['user'], state=state),
connected_accounts=data['connected_accounts'])

5
discord/user.py

@ -549,9 +549,10 @@ class User(BaseUser, discord.abc.Messageable):
def transform(d):
return state._get_guild(int(d['id']))
since = data.get('premium_since')
mutual_guilds = list(filter(None, map(transform, data.get('mutual_guilds', []))))
return Profile(premium=data['premium'],
premium_since=parse_time(data.get('premium_since')),
return Profile(premium=since is not None,
premium_since=parse_time(since),
mutual_guilds=mutual_guilds,
user=self,
connected_accounts=data['connected_accounts'])

Loading…
Cancel
Save