Filter presence updates to prevent updating everything, which might create cpu hog

This commit is contained in:
Jeremy Zhang 2017-09-16 16:53:39 +00:00
parent aa4fa4ed16
commit 46f5594763

View File

@ -168,6 +168,8 @@ class Titan(discord.Client):
await self.socketio.on_guild_member_remove(member)
async def on_member_update(self, memberbefore, memberafter):
if set(memberbefore.roles) != set(memberafter.roles) or memberbefore.avatar != memberafter.avatar or memberbefore.nick != memberafter.nick or memberbefore.name != memberafter.name or memberbefore.status != memberafter.status:
if memberbefore.status == memberafter.status:
await self.database.update_guild_member(memberafter)
await self.socketio.on_guild_member_update(memberafter)