diff --git a/Myriad/Types/User.cs b/Myriad/Types/User.cs index 49ac434c..57d427f2 100644 --- a/Myriad/Types/User.cs +++ b/Myriad/Types/User.cs @@ -23,6 +23,7 @@ public record User public ulong Id { get; init; } public string Username { get; init; } public string Discriminator { get; init; } + public string GlobalName { get; init; } public string? Avatar { get; init; } public bool Bot { get; init; } public bool? System { get; init; } diff --git a/PluralKit.Bot/Proxy/ProxyService.cs b/PluralKit.Bot/Proxy/ProxyService.cs index add74fbc..de643ea1 100644 --- a/PluralKit.Bot/Proxy/ProxyService.cs +++ b/PluralKit.Bot/Proxy/ProxyService.cs @@ -386,7 +386,7 @@ public class ProxyService content.Append($"*[(click to see attachment)]({jumpLink})*"); } - var username = nickname ?? repliedTo.Author.Username; + var username = nickname ?? repliedTo.Author.GlobalName ?? repliedTo.Author.Username; var avatarUrl = avatar != null ? $"https://cdn.discordapp.com/guilds/{trigger.GuildId}/users/{repliedTo.Author.Id}/avatars/{avatar}.png" : $"https://cdn.discordapp.com/avatars/{repliedTo.Author.Id}/{repliedTo.Author.Avatar}.png"; diff --git a/PluralKit.Bot/Utils/DiscordUtils.cs b/PluralKit.Bot/Utils/DiscordUtils.cs index f023fd0f..b3ea5625 100644 --- a/PluralKit.Bot/Utils/DiscordUtils.cs +++ b/PluralKit.Bot/Utils/DiscordUtils.cs @@ -35,7 +35,7 @@ public static class DiscordUtils private static readonly Regex UNBROKEN_LINK_REGEX = new("?"); public static string NameAndMention(this User user) => - $"{user.Username}#{user.Discriminator} ({user.Mention()})"; + $"{user.Username}{(user.Discriminator == "0" ? "" : $"#{user.Discriminator}")} ({user.Mention()})"; public static Instant SnowflakeToInstant(ulong snowflake) => Instant.FromUtc(2015, 1, 1, 0, 0, 0) + Duration.FromMilliseconds(snowflake >> 22);