diff --git a/src/Commands/BanCommandGroup.cs b/src/Commands/BanCommandGroup.cs index a8672a2..ff48156 100644 --- a/src/Commands/BanCommandGroup.cs +++ b/src/Commands/BanCommandGroup.cs @@ -153,7 +153,7 @@ public class BanCommandGroup : CommandGroup { .WithColour(ColorsList.Green).Build(); var logResult = _utility.LogActionAsync( - data.Settings, channelId, user, title, description, target, ct); + data.Settings, channelId, user, title, description, target, ColorsList.Red, ct: ct); if (!logResult.IsSuccess) return Result.FromError(logResult.Error); @@ -227,7 +227,8 @@ public class BanCommandGroup : CommandGroup { var title = string.Format(Messages.UserUnbanned, target.GetTag()); var description = string.Format(Messages.DescriptionActionReason, reason); - var logResult = _utility.LogActionAsync(data.Settings, channelId, user, title, description, target, ct); + var logResult = _utility.LogActionAsync( + data.Settings, channelId, user, title, description, target, ColorsList.Green, ct: ct); if (!logResult.IsSuccess) return Result.FromError(logResult.Error); diff --git a/src/Commands/ClearCommandGroup.cs b/src/Commands/ClearCommandGroup.cs index 46ddc24..0d35814 100644 --- a/src/Commands/ClearCommandGroup.cs +++ b/src/Commands/ClearCommandGroup.cs @@ -103,7 +103,7 @@ public class ClearCommandGroup : CommandGroup { return Result.FromError(deleteResult.Error); var logResult = _utility.LogActionAsync( - data.Settings, channelId, user, title, description, currentUser, ct); + data.Settings, channelId, user, title, description, currentUser, ColorsList.Red, false, ct); if (!logResult.IsSuccess) return Result.FromError(logResult.Error); diff --git a/src/Commands/KickCommandGroup.cs b/src/Commands/KickCommandGroup.cs index 9111b7f..09dd833 100644 --- a/src/Commands/KickCommandGroup.cs +++ b/src/Commands/KickCommandGroup.cs @@ -133,7 +133,7 @@ public class KickCommandGroup : CommandGroup { var title = string.Format(Messages.UserKicked, target.GetTag()); var description = string.Format(Messages.DescriptionActionReason, reason); var logResult = _utility.LogActionAsync( - data.Settings, channelId, user, title, description, target, ct); + data.Settings, channelId, user, title, description, target, ColorsList.Red, ct: ct); if (!logResult.IsSuccess) return Result.FromError(logResult.Error); diff --git a/src/Commands/MuteCommandGroup.cs b/src/Commands/MuteCommandGroup.cs index 14895d5..be31ee8 100644 --- a/src/Commands/MuteCommandGroup.cs +++ b/src/Commands/MuteCommandGroup.cs @@ -125,7 +125,7 @@ public class MuteCommandGroup : CommandGroup { Messages.DescriptionActionExpiresAt, Markdown.Timestamp(until))).ToString(); var logResult = _utility.LogActionAsync( - data.Settings, channelId, user, title, description, target, ct); + data.Settings, channelId, user, title, description, target, ColorsList.Red, ct: ct); if (!logResult.IsSuccess) return Result.FromError(logResult.Error); @@ -215,7 +215,7 @@ public class MuteCommandGroup : CommandGroup { var title = string.Format(Messages.UserUnmuted, target.GetTag()); var description = string.Format(Messages.DescriptionActionReason, reason); var logResult = _utility.LogActionAsync( - data.Settings, channelId, user, title, description, target, ct); + data.Settings, channelId, user, title, description, target, ColorsList.Green, ct: ct); if (!logResult.IsSuccess) return Result.FromError(logResult.Error); diff --git a/src/Services/UtilityService.cs b/src/Services/UtilityService.cs index 18808eb..81acd85 100644 --- a/src/Services/UtilityService.cs +++ b/src/Services/UtilityService.cs @@ -1,3 +1,4 @@ +using System.Drawing; using System.Text; using System.Text.Json.Nodes; using Boyfriend.Data; @@ -158,11 +159,13 @@ public class UtilityService : IHostedService { /// The title for the embed. /// The description of the embed. /// The user whose avatar will be displayed next to the of the embed. + /// The color of the embed. + /// Whether or not the embed should be sent in /// The cancellation token for this operation. - /// + /// A result which has succeeded. public Result LogActionAsync( - JsonNode cfg, Snowflake channelId, IUser user, string title, string description, IUser avatar, - CancellationToken ct = default) { + JsonNode cfg, Snowflake channelId, IUser user, string title, string description, IUser avatar, + Color color, bool isPublic = true, CancellationToken ct = default) { var publicChannel = GuildSettings.PublicFeedbackChannel.Get(cfg); var privateChannel = GuildSettings.PrivateFeedbackChannel.Get(cfg); if (GuildSettings.PublicFeedbackChannel.Get(cfg).EmptyOrEqualTo(channelId) @@ -173,7 +176,7 @@ public class UtilityService : IHostedService { .WithDescription(description) .WithActionFooter(user) .WithCurrentTimestamp() - .WithColour(ColorsList.Green) + .WithColour(color) .Build(); if (!logEmbed.IsDefined(out var logBuilt)) @@ -182,7 +185,7 @@ public class UtilityService : IHostedService { var builtArray = new[] { logBuilt }; // Not awaiting to reduce response time - if (publicChannel != channelId.Value) + if (isPublic && publicChannel != channelId.Value) _ = _channelApi.CreateMessageAsync( publicChannel, embeds: builtArray, ct: ct);