From 4c31ebf82661c53d9bd6b26e6d1fec342a13db5e Mon Sep 17 00:00:00 2001 From: mctaylors <95250141+mctaylors@users.noreply.github.com> Date: Thu, 8 Jun 2023 20:01:18 +0300 Subject: [PATCH] Added ColorsList.cs --- ColorsList.cs | 15 +++++++++++++++ Commands/BanCommand.cs | 9 ++++----- EventResponders.cs | 17 ++++++++--------- 3 files changed, 27 insertions(+), 14 deletions(-) create mode 100644 ColorsList.cs diff --git a/ColorsList.cs b/ColorsList.cs new file mode 100644 index 0000000..c2dc416 --- /dev/null +++ b/ColorsList.cs @@ -0,0 +1,15 @@ +using System.Drawing; + +namespace Boyfriend; + +public static class ColorsList { + public static readonly Color Default = Color.Gray; + public static readonly Color Red = Color.Firebrick; + public static readonly Color Green = Color.PaleGreen; + public static readonly Color Yellow = Color.Gold; + public static readonly Color Blue = Color.RoyalBlue; + public static readonly Color Magneta = Color.Orchid; + public static readonly Color Cyan = Color.LightSkyBlue; + public static readonly Color Black = Color.Black; + public static readonly Color White = Color.WhiteSmoke; +} diff --git a/Commands/BanCommand.cs b/Commands/BanCommand.cs index a8aa777..24e5678 100644 --- a/Commands/BanCommand.cs +++ b/Commands/BanCommand.cs @@ -1,5 +1,4 @@ using System.ComponentModel; -using System.Drawing; using Boyfriend.Services; using Boyfriend.Services.Data; using Remora.Commands.Attributes; @@ -58,7 +57,7 @@ public class BanCommand : CommandGroup { var existingBanResult = await _guildApi.GetGuildBanAsync(guildId.Value, target.ID, CancellationToken); if (existingBanResult.IsDefined(out _)) { var embed = new EmbedBuilder().WithSmallTitle(Messages.UserAlreadyBanned, currentUser) - .WithColour(Color.Firebrick).Build(); + .WithColour(ColorsList.Red).Build(); if (!embed.IsDefined(out var alreadyBuilt)) return Result.FromError(embed); @@ -74,7 +73,7 @@ public class BanCommand : CommandGroup { Result responseEmbed; if (interactionResult.Entity is not null) { responseEmbed = new EmbedBuilder().WithSmallTitle(interactionResult.Entity, currentUser) - .WithColour(Color.Firebrick).Build(); + .WithColour(ColorsList.Red).Build(); } else { var userResult = await _userApi.GetUserAsync(userId.Value, CancellationToken); if (!userResult.IsDefined(out var user)) @@ -87,7 +86,7 @@ public class BanCommand : CommandGroup { responseEmbed = new EmbedBuilder().WithSmallTitle( string.Format(Messages.UserBanned, target.GetTag()), target) - .WithColour(Color.LawnGreen).Build(); + .WithColour(ColorsList.Green).Build(); var cfg = await _dataService.GetConfiguration(guildId.Value, CancellationToken); if ((cfg.PublicFeedbackChannel is not 0 && cfg.PublicFeedbackChannel != channelId.Value) @@ -97,7 +96,7 @@ public class BanCommand : CommandGroup { .WithDescription(string.Format(Messages.DescriptionUserBanned, reason)) .WithActionFooter(user) .WithCurrentTimestamp() - .WithColour(Color.Firebrick) + .WithColour(ColorsList.Red) .Build(); if (!logEmbed.IsDefined(out var logBuilt)) diff --git a/EventResponders.cs b/EventResponders.cs index 4c44d2e..66be8f2 100644 --- a/EventResponders.cs +++ b/EventResponders.cs @@ -1,4 +1,3 @@ -using System.Drawing; using System.Text; using Boyfriend.Data; using Boyfriend.Services.Data; @@ -60,7 +59,7 @@ public class GuildCreateResponder : IResponder { .WithDescription(Messages.Ready) .WithUserFooter(currentUser) .WithCurrentTimestamp() - .WithColour(Color.Aqua) + .WithColour(ColorsList.Blue) .Build(); if (!embed.IsDefined(out var built)) return Result.FromError(embed); @@ -120,7 +119,7 @@ public class MessageDeletedResponder : IResponder { $"{Mention.Channel(gatewayEvent.ChannelID)}\n{Markdown.BlockCode(message.Content.SanitizeForBlockCode())}") .WithActionFooter(user) .WithTimestamp(message.Timestamp) - .WithColour(Color.Firebrick) + .WithColour(ColorsList.Red) .Build(); if (!embed.IsDefined(out var built)) return Result.FromError(embed); @@ -190,7 +189,7 @@ public class MessageEditedResponder : IResponder { .WithDescription($"https://discord.com/channels/{guildId}/{channelId}/{messageId}\n{diff.AsMarkdown()}") .WithUserFooter(currentUser) .WithTimestamp(timestamp.Value) - .WithColour(Color.Gold) + .WithColour(ColorsList.Yellow) .Build(); if (!embed.IsDefined(out var built)) return Result.FromError(embed); @@ -234,7 +233,7 @@ public class GuildMemberAddResponder : IResponder { .WithSmallTitle(string.Format(welcomeMessage, user.GetTag(), guild.Name), user) .WithGuildFooter(guild) .WithTimestamp(gatewayEvent.JoinedAt) - .WithColour(Color.LawnGreen) + .WithColour(ColorsList.Green) .Build(); if (!embed.IsDefined(out var built)) return Result.FromError(embed); @@ -318,7 +317,7 @@ public class GuildScheduledEventCreateResponder : IResponder