Browse Source

Parse roles in the member building.

pull/1/head
Rapptz 10 years ago
parent
commit
af5292872b
  1. 4
      discord/__init__.py
  2. 10
      discord/client.py

4
discord/__init__.py

@ -15,8 +15,8 @@ __title__ = 'discord'
__author__ = 'Rapptz'
__license__ = 'MIT'
__copyright__ = 'Copyright 2015 Rapptz'
__version__ = '0.3.0'
__build__ = 0x003000
__version__ = '0.3.1'
__build__ = 0x003010
from client import Client
from user import User

10
discord/client.py

@ -149,7 +149,15 @@ class Client(object):
for guild in guilds:
guild['roles'] = [Role(**role) for role in guild['roles']]
guild['members'] = [Member(**member) for member in guild['members']]
# guild['members'] = [Member(**member) for member in guild['members']]
members = guild['members']
for i, member in enumerate(members):
roles = member['roles']
for j, roleid in enumerate(roles):
role = next((r for r in guild['roles'] if r.id == roleid), None)
if role is not None:
roles[j] = role
members[i] = Member(**member)
server = Server(**guild)
for channel in guild['channels']:

Loading…
Cancel
Save