Browse Source

Change internal update functions to have a leading underscore.

pull/95/head
Rapptz 9 years ago
parent
commit
8974dffc4e
  1. 4
      discord/channel.py
  2. 4
      discord/member.py
  3. 4
      discord/role.py
  4. 2
      discord/server.py
  5. 4
      discord/state.py

4
discord/channel.py

@ -75,13 +75,13 @@ class Channel(Hashable):
"""
def __init__(self, **kwargs):
self.update(**kwargs)
self._update(**kwargs)
self.voice_members = []
def __str__(self):
return self.name
def update(self, **kwargs):
def _update(self, **kwargs):
self.name = kwargs.get('name')
self.server = kwargs.get('server')
self.id = kwargs.get('id')

4
discord/member.py

@ -79,9 +79,9 @@ class Member(User):
game = kwargs.get('game')
self.game = game and Game(**game)
self.server = kwargs.get('server', None)
self.update_voice_state(mute=mute, deaf=deaf)
self._update_voice_state(mute=mute, deaf=deaf)
def update_voice_state(self, **kwargs):
def _update_voice_state(self, **kwargs):
self.self_mute = kwargs.get('self_mute', False)
self.self_deaf = kwargs.get('self_deaf', False)
self.is_afk = kwargs.get('suppress', False)

4
discord/role.py

@ -69,12 +69,12 @@ class Role(Hashable):
def __init__(self, **kwargs):
self._is_everyone = kwargs.get('everyone', False)
self.update(**kwargs)
self._update(**kwargs)
def __str__(self):
return self.name
def update(self, **kwargs):
def _update(self, **kwargs):
self.id = kwargs.get('id')
self.name = kwargs.get('name')
self.permissions = Permissions(kwargs.get('permissions', 0))

2
discord/server.py

@ -132,7 +132,7 @@ class Server(Hashable):
if member is not None:
ch_id = data.get('channel_id')
channel = self.get_channel(ch_id)
member.update_voice_state(voice_channel=channel, **data)
member._update_voice_state(voice_channel=channel, **data)
return before, member
def _from_data(self, guild):

4
discord/state.py

@ -173,7 +173,7 @@ class ConnectionState:
channel = server.get_channel(channel_id)
if channel is not None:
old_channel = copy.copy(channel)
channel.update(server=server, **data)
channel._update(server=server, **data)
self.dispatch('channel_update', old_channel, channel)
def parse_channel_create(self, data):
@ -322,7 +322,7 @@ class ConnectionState:
role = utils.find(lambda r: r.id == role_id, server.roles)
if role is not None:
old_role = copy.copy(role)
role.update(**data['role'])
role._update(**data['role'])
self.dispatch('server_role_update', old_role, role)
def parse_voice_state_update(self, data):

Loading…
Cancel
Save