mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-25 06:27:03 +01:00
Update member if there are discreptancies in db
This commit is contained in:
parent
19ff2ffd46
commit
70b2b266c8
@ -174,10 +174,8 @@ class Titan(discord.AutoShardedClient):
|
||||
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.discriminator != memberafter.discriminator 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)
|
||||
await self.database.update_guild_member(memberafter)
|
||||
await self.socketio.on_guild_member_update(memberafter)
|
||||
|
||||
async def on_member_ban(self, guild, user):
|
||||
if self.user.id == user.id:
|
||||
|
@ -187,13 +187,14 @@ class DatabaseInterface(object):
|
||||
for mem in dbmember[1:]:
|
||||
session.delete(mem)
|
||||
dbmember = dbmember[0]
|
||||
dbmember.banned = banned
|
||||
dbmember.active = active
|
||||
dbmember.username = member.name
|
||||
dbmember.discriminator = member.discriminator
|
||||
dbmember.nickname = member.nick
|
||||
dbmember.avatar = member.avatar
|
||||
dbmember.roles = json.dumps(list_role_ids(member.roles))
|
||||
if dbmember.banned != banned or dbmember.active != active or dbmember.username != member.name or dbmember.discriminator != int(member.discriminator) or dbmember.nickname != member.nick or dbmember.avatar != member.avatar or set(json.loads(dbmember.roles)) != set(list_role_ids(member.roles)):
|
||||
dbmember.banned = banned
|
||||
dbmember.active = active
|
||||
dbmember.username = member.name
|
||||
dbmember.discriminator = member.discriminator
|
||||
dbmember.nickname = member.nick
|
||||
dbmember.avatar = member.avatar
|
||||
dbmember.roles = json.dumps(list_role_ids(member.roles))
|
||||
session.commit()
|
||||
|
||||
async def unban_server_user(self, user, server):
|
||||
|
Loading…
Reference in New Issue
Block a user