1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-20 00:43:36 +03:00

Added ColorsList.cs

This commit is contained in:
Macintxsh 2023-06-08 20:01:18 +03:00
parent c1179888d5
commit 4c31ebf826
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: CBB0BC4293CAF050
3 changed files with 27 additions and 14 deletions

15
ColorsList.cs Normal file
View file

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

View file

@ -1,5 +1,4 @@
using System.ComponentModel; using System.ComponentModel;
using System.Drawing;
using Boyfriend.Services; using Boyfriend.Services;
using Boyfriend.Services.Data; using Boyfriend.Services.Data;
using Remora.Commands.Attributes; using Remora.Commands.Attributes;
@ -58,7 +57,7 @@ public class BanCommand : CommandGroup {
var existingBanResult = await _guildApi.GetGuildBanAsync(guildId.Value, target.ID, CancellationToken); var existingBanResult = await _guildApi.GetGuildBanAsync(guildId.Value, target.ID, CancellationToken);
if (existingBanResult.IsDefined(out _)) { if (existingBanResult.IsDefined(out _)) {
var embed = new EmbedBuilder().WithSmallTitle(Messages.UserAlreadyBanned, currentUser) var embed = new EmbedBuilder().WithSmallTitle(Messages.UserAlreadyBanned, currentUser)
.WithColour(Color.Firebrick).Build(); .WithColour(ColorsList.Red).Build();
if (!embed.IsDefined(out var alreadyBuilt)) if (!embed.IsDefined(out var alreadyBuilt))
return Result.FromError(embed); return Result.FromError(embed);
@ -74,7 +73,7 @@ public class BanCommand : CommandGroup {
Result<Embed> responseEmbed; Result<Embed> responseEmbed;
if (interactionResult.Entity is not null) { if (interactionResult.Entity is not null) {
responseEmbed = new EmbedBuilder().WithSmallTitle(interactionResult.Entity, currentUser) responseEmbed = new EmbedBuilder().WithSmallTitle(interactionResult.Entity, currentUser)
.WithColour(Color.Firebrick).Build(); .WithColour(ColorsList.Red).Build();
} else { } else {
var userResult = await _userApi.GetUserAsync(userId.Value, CancellationToken); var userResult = await _userApi.GetUserAsync(userId.Value, CancellationToken);
if (!userResult.IsDefined(out var user)) if (!userResult.IsDefined(out var user))
@ -87,7 +86,7 @@ public class BanCommand : CommandGroup {
responseEmbed = new EmbedBuilder().WithSmallTitle( responseEmbed = new EmbedBuilder().WithSmallTitle(
string.Format(Messages.UserBanned, target.GetTag()), target) string.Format(Messages.UserBanned, target.GetTag()), target)
.WithColour(Color.LawnGreen).Build(); .WithColour(ColorsList.Green).Build();
var cfg = await _dataService.GetConfiguration(guildId.Value, CancellationToken); var cfg = await _dataService.GetConfiguration(guildId.Value, CancellationToken);
if ((cfg.PublicFeedbackChannel is not 0 && cfg.PublicFeedbackChannel != channelId.Value) if ((cfg.PublicFeedbackChannel is not 0 && cfg.PublicFeedbackChannel != channelId.Value)
@ -97,7 +96,7 @@ public class BanCommand : CommandGroup {
.WithDescription(string.Format(Messages.DescriptionUserBanned, reason)) .WithDescription(string.Format(Messages.DescriptionUserBanned, reason))
.WithActionFooter(user) .WithActionFooter(user)
.WithCurrentTimestamp() .WithCurrentTimestamp()
.WithColour(Color.Firebrick) .WithColour(ColorsList.Red)
.Build(); .Build();
if (!logEmbed.IsDefined(out var logBuilt)) if (!logEmbed.IsDefined(out var logBuilt))

View file

@ -1,4 +1,3 @@
using System.Drawing;
using System.Text; using System.Text;
using Boyfriend.Data; using Boyfriend.Data;
using Boyfriend.Services.Data; using Boyfriend.Services.Data;
@ -60,7 +59,7 @@ public class GuildCreateResponder : IResponder<IGuildCreate> {
.WithDescription(Messages.Ready) .WithDescription(Messages.Ready)
.WithUserFooter(currentUser) .WithUserFooter(currentUser)
.WithCurrentTimestamp() .WithCurrentTimestamp()
.WithColour(Color.Aqua) .WithColour(ColorsList.Blue)
.Build(); .Build();
if (!embed.IsDefined(out var built)) return Result.FromError(embed); if (!embed.IsDefined(out var built)) return Result.FromError(embed);
@ -120,7 +119,7 @@ public class MessageDeletedResponder : IResponder<IMessageDelete> {
$"{Mention.Channel(gatewayEvent.ChannelID)}\n{Markdown.BlockCode(message.Content.SanitizeForBlockCode())}") $"{Mention.Channel(gatewayEvent.ChannelID)}\n{Markdown.BlockCode(message.Content.SanitizeForBlockCode())}")
.WithActionFooter(user) .WithActionFooter(user)
.WithTimestamp(message.Timestamp) .WithTimestamp(message.Timestamp)
.WithColour(Color.Firebrick) .WithColour(ColorsList.Red)
.Build(); .Build();
if (!embed.IsDefined(out var built)) return Result.FromError(embed); if (!embed.IsDefined(out var built)) return Result.FromError(embed);
@ -190,7 +189,7 @@ public class MessageEditedResponder : IResponder<IMessageUpdate> {
.WithDescription($"https://discord.com/channels/{guildId}/{channelId}/{messageId}\n{diff.AsMarkdown()}") .WithDescription($"https://discord.com/channels/{guildId}/{channelId}/{messageId}\n{diff.AsMarkdown()}")
.WithUserFooter(currentUser) .WithUserFooter(currentUser)
.WithTimestamp(timestamp.Value) .WithTimestamp(timestamp.Value)
.WithColour(Color.Gold) .WithColour(ColorsList.Yellow)
.Build(); .Build();
if (!embed.IsDefined(out var built)) return Result.FromError(embed); if (!embed.IsDefined(out var built)) return Result.FromError(embed);
@ -234,7 +233,7 @@ public class GuildMemberAddResponder : IResponder<IGuildMemberAdd> {
.WithSmallTitle(string.Format(welcomeMessage, user.GetTag(), guild.Name), user) .WithSmallTitle(string.Format(welcomeMessage, user.GetTag(), guild.Name), user)
.WithGuildFooter(guild) .WithGuildFooter(guild)
.WithTimestamp(gatewayEvent.JoinedAt) .WithTimestamp(gatewayEvent.JoinedAt)
.WithColour(Color.LawnGreen) .WithColour(ColorsList.Green)
.Build(); .Build();
if (!embed.IsDefined(out var built)) return Result.FromError(embed); if (!embed.IsDefined(out var built)) return Result.FromError(embed);
@ -318,7 +317,7 @@ public class GuildScheduledEventCreateResponder : IResponder<IGuildScheduledEven
.WithEventCover(gatewayEvent.ID, gatewayEvent.Image) .WithEventCover(gatewayEvent.ID, gatewayEvent.Image)
.WithUserFooter(currentUser) .WithUserFooter(currentUser)
.WithCurrentTimestamp() .WithCurrentTimestamp()
.WithColour(Color.Gray) .WithColour(ColorsList.Default)
.Build(); .Build();
if (!embed.IsDefined(out var built)) return Result.FromError(embed); if (!embed.IsDefined(out var built)) return Result.FromError(embed);
@ -414,7 +413,7 @@ public class GuildScheduledEventUpdateResponder : IResponder<IGuildScheduledEven
embed.WithTitle(string.Format(Messages.EventStarted, gatewayEvent.Name)) embed.WithTitle(string.Format(Messages.EventStarted, gatewayEvent.Name))
.WithDescription(embedDescription) .WithDescription(embedDescription)
.WithCurrentTimestamp() .WithCurrentTimestamp()
.WithColour(Color.LawnGreen); .WithColour(ColorsList.Green);
break; break;
case GuildScheduledEventStatus.Completed: case GuildScheduledEventStatus.Completed:
embed.WithTitle(string.Format(Messages.EventCompleted, gatewayEvent.Name)) embed.WithTitle(string.Format(Messages.EventCompleted, gatewayEvent.Name))
@ -424,7 +423,7 @@ public class GuildScheduledEventUpdateResponder : IResponder<IGuildScheduledEven
DateTimeOffset.UtcNow.Subtract( DateTimeOffset.UtcNow.Subtract(
guildData.ScheduledEvents[gatewayEvent.ID.Value].ActualStartTime guildData.ScheduledEvents[gatewayEvent.ID.Value].ActualStartTime
?? gatewayEvent.ScheduledStartTime).ToString())) ?? gatewayEvent.ScheduledStartTime).ToString()))
.WithColour(Color.Black); .WithColour(ColorsList.Black);
guildData.ScheduledEvents.Remove(gatewayEvent.ID.Value); guildData.ScheduledEvents.Remove(gatewayEvent.ID.Value);
break; break;
@ -462,7 +461,7 @@ public class GuildScheduledEventResponder : IResponder<IGuildScheduledEventDelet
var embed = new EmbedBuilder() var embed = new EmbedBuilder()
.WithSmallTitle(string.Format(Messages.EventCancelled, gatewayEvent.Name)) .WithSmallTitle(string.Format(Messages.EventCancelled, gatewayEvent.Name))
.WithDescription(":(") .WithDescription(":(")
.WithColour(Color.Firebrick) .WithColour(ColorsList.Red)
.WithCurrentTimestamp() .WithCurrentTimestamp()
.Build(); .Build();