Fix the garish default D#+ colors

This commit is contained in:
Ske 2020-04-29 00:25:01 +02:00
parent 86b6a90b1c
commit 9fa36b78ff
4 changed files with 14 additions and 9 deletions

View File

@ -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());
}
}

View File

@ -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);
}
}

View File

@ -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"

View File

@ -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})";
}