|
|
@ -229,6 +229,11 @@ class State(object): |
|
|
|
elif event.channel.is_dm: |
|
|
|
self.dms[event.channel.id] = event.channel |
|
|
|
self.channels[event.channel.id] = event.channel |
|
|
|
for user in six.itervalues(event.channel.recipients): |
|
|
|
if user.id not in self.users: |
|
|
|
self.users[user.id] = user |
|
|
|
else: |
|
|
|
event.channel.recipients[user.id] = self.users[user.id] |
|
|
|
|
|
|
|
def on_channel_update(self, event): |
|
|
|
if event.channel.id in self.channels: |
|
|
@ -285,6 +290,11 @@ class State(object): |
|
|
|
if event.member.guild_id not in self.guilds: |
|
|
|
return |
|
|
|
|
|
|
|
if (self.guilds[event.member.guild_id].member_count is not UNSET and |
|
|
|
# Avoid adding duplicate events to member_count. |
|
|
|
event.member.id not in self.guilds[event.member.guild_id].members): |
|
|
|
self.guilds[event.member.guild_id].member_count += 1 |
|
|
|
|
|
|
|
self.guilds[event.member.guild_id].members[event.member.id] = event.member |
|
|
|
|
|
|
|
def on_guild_member_update(self, event): |
|
|
@ -303,6 +313,9 @@ class State(object): |
|
|
|
if event.user.id not in self.guilds[event.guild_id].members: |
|
|
|
return |
|
|
|
|
|
|
|
if self.guilds[event.guild_id].member_count is not UNSET: |
|
|
|
self.guilds[event.guild_id].member_count -= 1 |
|
|
|
|
|
|
|
del self.guilds[event.guild_id].members[event.user.id] |
|
|
|
|
|
|
|
def on_guild_members_chunk(self, event): |
|
|
@ -319,6 +332,15 @@ class State(object): |
|
|
|
else: |
|
|
|
member.user = self.users[member.id] |
|
|
|
|
|
|
|
if not event.presences: |
|
|
|
return |
|
|
|
|
|
|
|
for presence in event.presences: |
|
|
|
if presence.user.id not in self.users: |
|
|
|
self.users[presence.user.id] = presence.user |
|
|
|
|
|
|
|
self.users[presence.user.id].presence = presence |
|
|
|
|
|
|
|
def on_guild_role_create(self, event): |
|
|
|
if event.guild_id not in self.guilds: |
|
|
|
return |
|
|
|