Browse Source

Add support for the new permission serialization scheme.

pull/6441/head
Rapptz 5 years ago
parent
commit
272339d5e6
  1. 8
      discord/abc.py
  2. 4
      discord/role.py

8
discord/abc.py

@ -168,15 +168,15 @@ class _Overwrites:
def __init__(self, **kwargs):
self.id = kwargs.pop('id')
self.allow = kwargs.pop('allow', 0)
self.deny = kwargs.pop('deny', 0)
self.allow = int(kwargs.pop('allow_new', 0))
self.deny = int(kwargs.pop('deny_new', 0))
self.type = sys.intern(kwargs.pop('type'))
def _asdict(self):
return {
'id': self.id,
'allow': self.allow,
'deny': self.deny,
'allow': str(self.allow),
'deny': str(self.deny),
'type': self.type,
}

4
discord/role.py

@ -188,7 +188,7 @@ class Role(Hashable):
def _update(self, data):
self.name = data['name']
self._permissions = data.get('permissions', 0)
self._permissions = int(data.get('permissions_new', 0))
self.position = data.get('position', 0)
self._colour = data.get('color', 0)
self.hoist = data.get('hoist', False)
@ -340,7 +340,7 @@ class Role(Hashable):
payload = {
'name': fields.get('name', self.name),
'permissions': fields.get('permissions', self.permissions).value,
'permissions': str(fields.get('permissions', self.permissions).value),
'color': colour.value,
'hoist': fields.get('hoist', self.hoist),
'mentionable': fields.get('mentionable', self.mentionable)

Loading…
Cancel
Save