Skip to content

Commit

Permalink
[ExtendedModLog] Clarify timeout update message
Browse files Browse the repository at this point in the history
closes #339
  • Loading branch information
TrustyJAID committed Jul 29, 2024
1 parent 1bfaeb9 commit 272b413
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions extendedmodlog/eventmixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def names():
MemberUpdateEnum.nicknames: _("Nickname"),
MemberUpdateEnum.roles: _("Roles"),
MemberUpdateEnum.pending: _("Pending"),
MemberUpdateEnum.timeout: _("Timeout"),
MemberUpdateEnum.timeout: _("Timeout until"),
MemberUpdateEnum.avatar: _("Guild Avatar"),
MemberUpdateEnum.flags: _("Flags"),
}
Expand Down Expand Up @@ -1938,10 +1938,10 @@ async def on_member_update(self, before: discord.Member, after: discord.Member)
embed.set_image(url=after_attr)
if after_attr:
embed.description += _(
"{author} changed their [guild avatar]({after_attr}).\n"
"- {author} changed their [guild avatar]({after_attr}).\n"
).format(author=after.mention, after_attr=after_attr)
else:
embed.description += _("{author} removed their guild avatar.\n").format(
embed.description += _("- {author} removed their guild avatar.\n").format(
author=after.mention, after_attr=after_attr
)

Expand All @@ -1953,14 +1953,18 @@ async def on_member_update(self, before: discord.Member, after: discord.Member)
reason = getattr(entry, "reason", None)
worth_sending = True
if isinstance(before_attr, datetime.datetime):
before_attr = discord.utils.format_dt(before_attr)
before_ts = discord.utils.format_dt(before_attr)
before_ts_rel = discord.utils.format_dt(before_attr, style="R")
before_attr = f"{before_ts} ({before_ts_rel})"
if isinstance(after_attr, datetime.datetime):
after_attr = discord.utils.format_dt(after_attr)
after_ts = discord.utils.format_dt(after_attr)
after_ts_rel = discord.utils.format_dt(after_attr, style="R")
after_attr = f"{after_ts} ({after_ts_rel})"
msg += _("Before ") + f"{update_type.get_name()} {before_attr}\n"
msg += _("After ") + f"{update_type.get_name()} {after_attr}\n"
embed.description = _("{author} has updated.").format(author=after.mention)
before_text += f"{update_type.get_name()} {before_attr}\n"
after_text += f"{update_type.get_name()} {after_attr}\n"
before_text += f"- {update_type.get_name()}: {before_attr}\n"
after_text += f"- {update_type.get_name()}: {after_attr}\n"
# embed.add_field(name=_("Before ") + name, value=str(before_attr)[:1024])
# embed.add_field(name=_("After ") + name, value=str(after_attr)[:1024])
if before_text and after_text:
Expand Down

0 comments on commit 272b413

Please sign in to comment.