Skip to content

Commit

Permalink
Merge branch 'main' into jb3/dynamic-init-version
Browse files Browse the repository at this point in the history
  • Loading branch information
jb3 authored Sep 4, 2023
2 parents 4668c16 + 20cc956 commit 69176c4
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions metricity/exts/event_listeners/member_listeners.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,21 @@ async def on_member_join(self, member: discord.Member) -> None:
in_guild=True,
))
else:
with contextlib.suppress(UniqueViolationError):
sess.add(User(
id=str(member.id),
name=member.name,
avatar_hash=getattr(member.avatar, "key", None),
guild_avatar_hash=getattr(member.guild_avatar, "key", None),
joined_at=member.joined_at,
created_at=member.created_at,
is_staff=BotConfig.staff_role_id in [role.id for role in member.roles],
public_flags=dict(member.public_flags),
pending=member.pending,
in_guild=True,
))
sess.add(User(
id=str(member.id),
name=member.name,
avatar_hash=getattr(member.avatar, "key", None),
guild_avatar_hash=getattr(member.guild_avatar, "key", None),
joined_at=member.joined_at,
created_at=member.created_at,
is_staff=BotConfig.staff_role_id in [role.id for role in member.roles],
public_flags=dict(member.public_flags),
pending=member.pending,
in_guild=True,
))

await sess.commit()
with contextlib.suppress(UniqueViolationError):
await sess.commit()

@commands.Cog.listener()
async def on_member_update(self, _before: discord.Member, member: discord.Member) -> None:
Expand Down Expand Up @@ -108,21 +108,21 @@ async def on_member_update(self, _before: discord.Member, member: discord.Member
pending=member.pending,
))
else:
with contextlib.suppress(UniqueViolationError):
sess.add(User(
id=str(member.id),
name=member.name,
avatar_hash=getattr(member.avatar, "key", None),
guild_avatar_hash=getattr(member.guild_avatar, "key", None),
joined_at=member.joined_at,
created_at=member.created_at,
is_staff=BotConfig.staff_role_id in roles,
public_flags=dict(member.public_flags),
in_guild=True,
pending=member.pending,
))
sess.add(User(
id=str(member.id),
name=member.name,
avatar_hash=getattr(member.avatar, "key", None),
guild_avatar_hash=getattr(member.guild_avatar, "key", None),
joined_at=member.joined_at,
created_at=member.created_at,
is_staff=BotConfig.staff_role_id in roles,
public_flags=dict(member.public_flags),
in_guild=True,
pending=member.pending,
))

await sess.commit()
with contextlib.suppress(UniqueViolationError):
await sess.commit()



Expand Down

0 comments on commit 69176c4

Please sign in to comment.