From 9fa36b78ffdf9ecf62b5c6c34bfe157ec6dfaab1 Mon Sep 17 00:00:00 2001 From: Ske Date: Wed, 29 Apr 2020 00:25:01 +0200 Subject: [PATCH] Fix the garish default D#+ colors --- PluralKit.Bot/Commands/Help.cs | 2 +- PluralKit.Bot/Commands/Misc.cs | 4 ++-- PluralKit.Bot/Services/EmbedService.cs | 12 ++++++------ PluralKit.Bot/Utils/DiscordUtils.cs | 5 +++++ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/PluralKit.Bot/Commands/Help.cs b/PluralKit.Bot/Commands/Help.cs index de4a6d12..b52f6d36 100644 --- a/PluralKit.Bot/Commands/Help.cs +++ b/PluralKit.Bot/Commands/Help.cs @@ -20,7 +20,7 @@ namespace PluralKit.Bot .AddField("More information", "For a full list of commands, see [the command list](https://pluralkit.me/commands).\nFor a more in-depth explanation of message proxying, see [the documentation](https://pluralkit.me/guide#proxying).\nIf you're an existing user of Tupperbox, type `pk;import` and attach a Tupperbox export file (from `tul!export`) to import your data from there.") .AddField("Support server", "We also have a Discord server for support, discussion, suggestions, announcements, etc: https://discord.gg/PczBt78") .WithFooter("By @Ske#6201 | GitHub: https://github.com/xSke/PluralKit/ | Website: https://pluralkit.me/") - .WithColor(DiscordColor.Blue) + .WithColor(DiscordUtils.Blue) .Build()); } } diff --git a/PluralKit.Bot/Commands/Misc.cs b/PluralKit.Bot/Commands/Misc.cs index b91448ce..095e0298 100644 --- a/PluralKit.Bot/Commands/Misc.cs +++ b/PluralKit.Bot/Commands/Misc.cs @@ -147,7 +147,7 @@ namespace PluralKit.Bot { if (permissionsMissing.Count == 0) { - eb.WithDescription($"No errors found, all channels proxyable :)").WithColor(DiscordColor.Green); + eb.WithDescription($"No errors found, all channels proxyable :)").WithColor(DiscordUtils.Green); } else { @@ -161,7 +161,7 @@ namespace PluralKit.Bot { .OrderBy(c => c.Position) .Select(c => $"#{c.Name}")); eb.AddField($"Missing *{missingPermissionNames}*", channelsList.Truncate(1000)); - eb.WithColor(DiscordColor.Red); + eb.WithColor(DiscordUtils.Red); } } diff --git a/PluralKit.Bot/Services/EmbedService.cs b/PluralKit.Bot/Services/EmbedService.cs index 7be34979..f3f35cd8 100644 --- a/PluralKit.Bot/Services/EmbedService.cs +++ b/PluralKit.Bot/Services/EmbedService.cs @@ -31,7 +31,7 @@ namespace PluralKit.Bot { var memberCount = await _data.GetSystemMemberCount(system, false); var eb = new DiscordEmbedBuilder() - .WithColor(DiscordColor.Blue) + .WithColor(DiscordUtils.Gray) .WithTitle(system.Name ?? null) .WithThumbnailUrl(system.AvatarUrl ?? null) .WithFooter($"System ID: {system.Hid} | Created on {DateTimeFormats.ZonedDateTimeFormat.Format(system.Created.InZone(system.Zone))}"); @@ -81,14 +81,14 @@ namespace PluralKit.Bot { DiscordColor color; try { - color = member.Color?.ToDiscordColor() ?? DiscordColor.Gray; + color = member.Color?.ToDiscordColor() ?? DiscordUtils.Gray; } catch (ArgumentException) { // Bad API use can cause an invalid color string // TODO: fix that in the API // for now we just default to a blank color, yolo - color = DiscordColor.Gray; + color = DiscordUtils.Gray; } var messageCount = await _data.GetMemberMessageCount(member); @@ -102,7 +102,7 @@ namespace PluralKit.Bot { var eb = new DiscordEmbedBuilder() // TODO: add URL of website when that's up .WithAuthor(name, avatar) - .WithColor(member.MemberPrivacy.CanAccess(ctx) ? color : DiscordColor.Gray) + .WithColor(member.MemberPrivacy.CanAccess(ctx) ? color : DiscordUtils.Gray) .WithFooter($"System ID: {system.Hid} | Member ID: {member.Hid} | Created on {DateTimeFormats.ZonedDateTimeFormat.Format(member.Created.InZone(system.Zone))}"); var description = ""; @@ -133,7 +133,7 @@ namespace PluralKit.Bot { var members = await _data.GetSwitchMembers(sw).ToListAsync(); var timeSinceSwitch = SystemClock.Instance.GetCurrentInstant() - sw.Timestamp; return new DiscordEmbedBuilder() - .WithColor(members.FirstOrDefault()?.Color?.ToDiscordColor() ?? DiscordColor.Blue) + .WithColor(members.FirstOrDefault()?.Color?.ToDiscordColor() ?? DiscordUtils.Gray) .AddField($"Current {"fronter".ToQuantity(members.Count, ShowQuantityAs.None)}", members.Count > 0 ? string.Join(", ", members.Select(m => m.Name)) : "*(no fronter)*") .AddField("Since", $"{DateTimeFormats.ZonedDateTimeFormat.Format(sw.Timestamp.InZone(zone))} ({DateTimeFormats.DurationFormat.Format(timeSinceSwitch)} ago)") .Build(); @@ -185,7 +185,7 @@ namespace PluralKit.Bot { { var actualPeriod = breakdown.RangeEnd - breakdown.RangeStart; var eb = new DiscordEmbedBuilder() - .WithColor(DiscordColor.Blue) + .WithColor(DiscordUtils.Gray) .WithFooter($"Since {DateTimeFormats.ZonedDateTimeFormat.Format(breakdown.RangeStart.InZone(tz))} ({DateTimeFormats.DurationFormat.Format(actualPeriod)} ago)"); var maxEntriesToDisplay = 24; // max 25 fields allowed in embed - reserve 1 for "others" diff --git a/PluralKit.Bot/Utils/DiscordUtils.cs b/PluralKit.Bot/Utils/DiscordUtils.cs index d64c3f46..0598d7d1 100644 --- a/PluralKit.Bot/Utils/DiscordUtils.cs +++ b/PluralKit.Bot/Utils/DiscordUtils.cs @@ -10,6 +10,11 @@ namespace PluralKit.Bot { public static class DiscordUtils { + public static DiscordColor Blue = new DiscordColor(0x1f99d8); + public static DiscordColor Green = new DiscordColor(0x00cc78); + public static DiscordColor Red = new DiscordColor(0xef4b3d); + public static DiscordColor Gray = new DiscordColor(0x979c9f); + public static string NameAndMention(this DiscordUser user) { return $"{user.Username}#{user.Discriminator} ({user.Mention})"; }