From c26a603c8d5ee94a63b193cde2a0689f097d4b0b Mon Sep 17 00:00:00 2001 From: Red-GitHubBot <88117545+Red-GitHubBot@users.noreply.github.com> Date: Sat, 25 Dec 2021 17:35:41 +0100 Subject: [PATCH] [3.4] isolate direction of username within modlog (#5422) (#5488) * isolate direction of username within modlog * Add link to Unicode's usage (cherry picked from commit 7db3339abab6b2abf46bd871e57921c508c7cd02) Co-authored-by: Jan Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com> Co-authored-by: Jan Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com> --- redbot/core/modlog.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/redbot/core/modlog.py b/redbot/core/modlog.py index 69ec40fb8..087dca624 100644 --- a/redbot/core/modlog.py +++ b/redbot/core/modlog.py @@ -464,10 +464,21 @@ class Case: translated = _("Unknown or Deleted User") user = f"[{translated}] ({self.user})" else: - user = f"{self.last_known_username} ({self.user})" + # See usage explanation here: https://www.unicode.org/reports/tr9/#Formatting + name = self.last_known_username[:-5] + discriminator = self.last_known_username[-4:] + user = ( + f"\N{FIRST STRONG ISOLATE}{name}" + f"\N{POP DIRECTIONAL ISOLATE}#{discriminator} ({self.user})" + ) else: + # isolate the name so that the direction of the discriminator and ID do not get changed + # See usage explanation here: https://www.unicode.org/reports/tr9/#Formatting user = escape_spoilers( - filter_invites(f"{self.user} ({self.user.id})") + filter_invites( + f"\N{FIRST STRONG ISOLATE}{self.user.name}" + f"\N{POP DIRECTIONAL ISOLATE}#{self.user.discriminator} ({self.user.id})" + ) ) # Invites and spoilers get rendered even in embeds. if embed: