From 99c1587e7b13fb04964704a3e2964475420f5b5e Mon Sep 17 00:00:00 2001 From: sam Date: Fri, 16 Aug 2024 17:04:24 +0200 Subject: [PATCH] reformat --- Catalogger.Backend/Bot/DiscordUtils.cs | 2 +- .../Bot/Responders/GuildCreateResponder.cs | 6 +-- .../Cache/ChannelCacheService.cs | 3 +- Catalogger.Backend/Cache/GuildCacheService.cs | 2 +- Catalogger.Backend/Cache/UserCacheService.cs | 2 +- Catalogger.Backend/Catalogger.Backend.csproj | 40 +++++++++---------- Catalogger.Backend/CataloggerMetrics.cs | 4 +- Catalogger.Backend/Database/Models/Guild.cs | 3 +- .../Database/Models/Watchlist.cs | 2 +- Catalogger.Backend/Database/QueryUtils.cs | 2 +- Catalogger.Backend/GlobalUsing.cs | 2 +- Catalogger.Backend/Services/IWebhookCache.cs | 2 +- 12 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Catalogger.Backend/Bot/DiscordUtils.cs b/Catalogger.Backend/Bot/DiscordUtils.cs index 4fd0c60..2a93b53 100644 --- a/Catalogger.Backend/Bot/DiscordUtils.cs +++ b/Catalogger.Backend/Bot/DiscordUtils.cs @@ -7,7 +7,7 @@ namespace Catalogger.Backend.Bot; public static class DiscordUtils { public static readonly Snowflake PkUserId = DiscordSnowflake.New(466378653216014359); - + public static readonly Color Red = Color.FromArgb(231, 76, 60); public static readonly Color Purple = Color.FromArgb(155, 89, 182); } \ No newline at end of file diff --git a/Catalogger.Backend/Bot/Responders/GuildCreateResponder.cs b/Catalogger.Backend/Bot/Responders/GuildCreateResponder.cs index eb7324e..18d3174 100644 --- a/Catalogger.Backend/Bot/Responders/GuildCreateResponder.cs +++ b/Catalogger.Backend/Bot/Responders/GuildCreateResponder.cs @@ -54,7 +54,7 @@ public class GuildCreateResponder( await tx.CommitAsync(ct); _logger.Information("Joined new guild {GuildName} / {GuildId}", guildName, guildId); - + if (config.Discord.GuildLogId != null && evt.Guild.IsT0) await webhookExecutor.QueueLogAsync(config.Discord.GuildLogId.Value, new EmbedBuilder() .WithTitle("Joined new guild") @@ -83,9 +83,9 @@ public class GuildCreateResponder( _logger.Information("Left uncached guild {GuildId}", evt.ID); return Result.Success; } - + _logger.Information("Left guild {GuildName} / {GuildId}", guild.Name, guild.ID); - + if (config.Discord.GuildLogId != null) await webhookExecutor.QueueLogAsync(config.Discord.GuildLogId.Value, new EmbedBuilder() .WithTitle("Left guild") diff --git a/Catalogger.Backend/Cache/ChannelCacheService.cs b/Catalogger.Backend/Cache/ChannelCacheService.cs index bd54eb1..4423b5b 100644 --- a/Catalogger.Backend/Cache/ChannelCacheService.cs +++ b/Catalogger.Backend/Cache/ChannelCacheService.cs @@ -31,7 +31,8 @@ public class ChannelCacheService }); } - public bool TryGet(Snowflake id, [NotNullWhen(true)] out IChannel? channel) => _channels.TryGetValue(id, out channel); + public bool TryGet(Snowflake id, [NotNullWhen(true)] out IChannel? channel) => + _channels.TryGetValue(id, out channel); public void Remove(Snowflake? guildId, Snowflake id, out IChannel? channel) { diff --git a/Catalogger.Backend/Cache/GuildCacheService.cs b/Catalogger.Backend/Cache/GuildCacheService.cs index 1a74bd1..a97eed1 100644 --- a/Catalogger.Backend/Cache/GuildCacheService.cs +++ b/Catalogger.Backend/Cache/GuildCacheService.cs @@ -10,7 +10,7 @@ public class GuildCacheService private readonly ConcurrentDictionary _guilds = new(); public int Size => _guilds.Count; - + public void Set(IGuild guild) => _guilds[guild.ID] = guild; public bool Remove(Snowflake id, [NotNullWhen(true)] out IGuild? guild) => _guilds.Remove(id, out guild); public bool TryGet(Snowflake id, [NotNullWhen(true)] out IGuild? guild) => _guilds.TryGetValue(id, out guild); diff --git a/Catalogger.Backend/Cache/UserCacheService.cs b/Catalogger.Backend/Cache/UserCacheService.cs index 0737878..867fb5d 100644 --- a/Catalogger.Backend/Cache/UserCacheService.cs +++ b/Catalogger.Backend/Cache/UserCacheService.cs @@ -8,7 +8,7 @@ namespace Catalogger.Backend.Cache; public class UserCacheService(IDiscordRestUserAPI userApi) { private readonly ConcurrentDictionary _cache = new(); - + public int Size => _cache.Count; public async Task GetUserAsync(Snowflake userId) diff --git a/Catalogger.Backend/Catalogger.Backend.csproj b/Catalogger.Backend/Catalogger.Backend.csproj index ef8a6b0..362da66 100644 --- a/Catalogger.Backend/Catalogger.Backend.csproj +++ b/Catalogger.Backend/Catalogger.Backend.csproj @@ -7,29 +7,29 @@ - - - - + + + + - + - all - runtime; build; native; contentfiles; analyzers; buildtransitive + all + runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/Catalogger.Backend/CataloggerMetrics.cs b/Catalogger.Backend/CataloggerMetrics.cs index 4ef57b6..8bedc87 100644 --- a/Catalogger.Backend/CataloggerMetrics.cs +++ b/Catalogger.Backend/CataloggerMetrics.cs @@ -28,7 +28,7 @@ public static class CataloggerMetrics MeasurementUnit = Unit.Items, Context = "Bot" }; - + public static GaugeOptions UsersCached => new() { Name = "Users cached", @@ -50,7 +50,7 @@ public static class CataloggerMetrics DurationUnit = TimeUnit.Milliseconds, Context = "Bot" }; - + public static GaugeOptions ProcessPhysicalMemory => new() { Name = "Process physical memory", diff --git a/Catalogger.Backend/Database/Models/Guild.cs b/Catalogger.Backend/Database/Models/Guild.cs index 681db4b..5696a4b 100644 --- a/Catalogger.Backend/Database/Models/Guild.cs +++ b/Catalogger.Backend/Database/Models/Guild.cs @@ -9,8 +9,7 @@ public class Guild [DatabaseGenerated(DatabaseGeneratedOption.None)] public required ulong Id { get; init; } - [Column(TypeName = "jsonb")] - public ChannelConfig Channels { get; init; } = new(); + [Column(TypeName = "jsonb")] public ChannelConfig Channels { get; init; } = new(); public List BannedSystems { get; init; } = []; public List KeyRoles { get; init; } = []; diff --git a/Catalogger.Backend/Database/Models/Watchlist.cs b/Catalogger.Backend/Database/Models/Watchlist.cs index 61bff48..4f94adc 100644 --- a/Catalogger.Backend/Database/Models/Watchlist.cs +++ b/Catalogger.Backend/Database/Models/Watchlist.cs @@ -7,7 +7,7 @@ public class Watchlist public required ulong GuildId { get; init; } public required ulong UserId { get; init; } public Instant AddedAt { get; init; } - + public required ulong ModeratorId { get; set; } public required string Reason { get; set; } } \ No newline at end of file diff --git a/Catalogger.Backend/Database/QueryUtils.cs b/Catalogger.Backend/Database/QueryUtils.cs index 5459fdc..5defa3e 100644 --- a/Catalogger.Backend/Database/QueryUtils.cs +++ b/Catalogger.Backend/Database/QueryUtils.cs @@ -1,3 +1,3 @@ using NodaTime; -namespace Catalogger.Backend.Database; +namespace Catalogger.Backend.Database; \ No newline at end of file diff --git a/Catalogger.Backend/GlobalUsing.cs b/Catalogger.Backend/GlobalUsing.cs index dd1fe48..bcd04ee 100644 --- a/Catalogger.Backend/GlobalUsing.cs +++ b/Catalogger.Backend/GlobalUsing.cs @@ -1 +1 @@ -global using ILogger = Serilog.ILogger; +global using ILogger = Serilog.ILogger; \ No newline at end of file diff --git a/Catalogger.Backend/Services/IWebhookCache.cs b/Catalogger.Backend/Services/IWebhookCache.cs index c3033b1..84c4881 100644 --- a/Catalogger.Backend/Services/IWebhookCache.cs +++ b/Catalogger.Backend/Services/IWebhookCache.cs @@ -16,7 +16,7 @@ public interface IWebhookCache if (webhook != null) return webhook.Value; var discordWebhook = await fetch(DiscordSnowflake.New(channelId)); - webhook = new Webhook { Id = discordWebhook.ID.ToUlong(), Token = discordWebhook.Token.Value}; + webhook = new Webhook { Id = discordWebhook.ID.ToUlong(), Token = discordWebhook.Token.Value }; await SetWebhookAsync(channelId, webhook.Value); return webhook.Value; }