From d03e2504fc0640f8dd2d3a4b335ca9718af75c79 Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Thu, 23 May 2024 17:47:51 +0500 Subject: [PATCH] Seal implicitly used classes (#309) Apparently the `[UsedImplicitly]` annotation suppresses the "Class has no inheritors and can be marked sealed" warning. Cool to know. Signed-off-by: Octol1ttle --- TeamOctolings.Octobot/Commands/AboutCommandGroup.cs | 4 ++-- TeamOctolings.Octobot/Commands/BanCommandGroup.cs | 2 +- TeamOctolings.Octobot/Commands/ClearCommandGroup.cs | 2 +- .../Commands/Events/ErrorLoggingPostExecutionEvent.cs | 2 +- .../Commands/Events/LoggingPreparationErrorEvent.cs | 2 +- TeamOctolings.Octobot/Commands/InfoCommandGroup.cs | 2 +- TeamOctolings.Octobot/Commands/KickCommandGroup.cs | 2 +- TeamOctolings.Octobot/Commands/MuteCommandGroup.cs | 2 +- TeamOctolings.Octobot/Commands/PingCommandGroup.cs | 2 +- TeamOctolings.Octobot/Commands/RemindCommandGroup.cs | 4 ++-- TeamOctolings.Octobot/Commands/SettingsCommandGroup.cs | 2 +- TeamOctolings.Octobot/Commands/ToolsCommandGroup.cs | 2 +- TeamOctolings.Octobot/Responders/GuildLoadedResponder.cs | 2 +- .../Responders/GuildMemberJoinedResponder.cs | 2 +- TeamOctolings.Octobot/Responders/GuildMemberLeftResponder.cs | 2 +- TeamOctolings.Octobot/Responders/GuildUnloadedResponder.cs | 2 +- TeamOctolings.Octobot/Responders/MessageDeletedResponder.cs | 2 +- TeamOctolings.Octobot/Responders/MessageEditedResponder.cs | 2 +- TeamOctolings.Octobot/Responders/MessageReceivedResponder.cs | 2 +- 19 files changed, 21 insertions(+), 21 deletions(-) diff --git a/TeamOctolings.Octobot/Commands/AboutCommandGroup.cs b/TeamOctolings.Octobot/Commands/AboutCommandGroup.cs index 9f05af3..dbb8b12 100644 --- a/TeamOctolings.Octobot/Commands/AboutCommandGroup.cs +++ b/TeamOctolings.Octobot/Commands/AboutCommandGroup.cs @@ -25,7 +25,7 @@ namespace TeamOctolings.Octobot.Commands; /// Handles the command to show information about this bot: /about. /// [UsedImplicitly] -public class AboutCommandGroup : CommandGroup +public sealed class AboutCommandGroup : CommandGroup { private static readonly (string Username, Snowflake Id)[] Developers = [ @@ -36,9 +36,9 @@ private static readonly (string Username, Snowflake Id)[] Developers = private readonly ICommandContext _context; private readonly IFeedbackService _feedback; + private readonly IDiscordRestGuildAPI _guildApi; private readonly GuildDataService _guildData; private readonly IDiscordRestUserAPI _userApi; - private readonly IDiscordRestGuildAPI _guildApi; public AboutCommandGroup( ICommandContext context, GuildDataService guildData, diff --git a/TeamOctolings.Octobot/Commands/BanCommandGroup.cs b/TeamOctolings.Octobot/Commands/BanCommandGroup.cs index 8d90286..69be80f 100644 --- a/TeamOctolings.Octobot/Commands/BanCommandGroup.cs +++ b/TeamOctolings.Octobot/Commands/BanCommandGroup.cs @@ -26,7 +26,7 @@ namespace TeamOctolings.Octobot.Commands; /// Handles commands related to ban management: /ban and /unban. /// [UsedImplicitly] -public class BanCommandGroup : CommandGroup +public sealed class BanCommandGroup : CommandGroup { private readonly AccessControlService _access; private readonly IDiscordRestChannelAPI _channelApi; diff --git a/TeamOctolings.Octobot/Commands/ClearCommandGroup.cs b/TeamOctolings.Octobot/Commands/ClearCommandGroup.cs index 8a8cb2f..38d864b 100644 --- a/TeamOctolings.Octobot/Commands/ClearCommandGroup.cs +++ b/TeamOctolings.Octobot/Commands/ClearCommandGroup.cs @@ -23,7 +23,7 @@ namespace TeamOctolings.Octobot.Commands; /// Handles the command to clear messages in a channel: /clear. /// [UsedImplicitly] -public class ClearCommandGroup : CommandGroup +public sealed class ClearCommandGroup : CommandGroup { private readonly IDiscordRestChannelAPI _channelApi; private readonly ICommandContext _context; diff --git a/TeamOctolings.Octobot/Commands/Events/ErrorLoggingPostExecutionEvent.cs b/TeamOctolings.Octobot/Commands/Events/ErrorLoggingPostExecutionEvent.cs index 7ffc4fe..7409d3b 100644 --- a/TeamOctolings.Octobot/Commands/Events/ErrorLoggingPostExecutionEvent.cs +++ b/TeamOctolings.Octobot/Commands/Events/ErrorLoggingPostExecutionEvent.cs @@ -18,7 +18,7 @@ namespace TeamOctolings.Octobot.Commands.Events; /// Handles error logging for slash command groups. /// [UsedImplicitly] -public class ErrorLoggingPostExecutionEvent : IPostExecutionEvent +public sealed class ErrorLoggingPostExecutionEvent : IPostExecutionEvent { private readonly IFeedbackService _feedback; private readonly ILogger _logger; diff --git a/TeamOctolings.Octobot/Commands/Events/LoggingPreparationErrorEvent.cs b/TeamOctolings.Octobot/Commands/Events/LoggingPreparationErrorEvent.cs index 10a6a1f..9e69a7f 100644 --- a/TeamOctolings.Octobot/Commands/Events/LoggingPreparationErrorEvent.cs +++ b/TeamOctolings.Octobot/Commands/Events/LoggingPreparationErrorEvent.cs @@ -11,7 +11,7 @@ namespace TeamOctolings.Octobot.Commands.Events; /// Handles error logging for slash commands that couldn't be successfully prepared. /// [UsedImplicitly] -public class LoggingPreparationErrorEvent : IPreparationErrorEvent +public sealed class LoggingPreparationErrorEvent : IPreparationErrorEvent { private readonly ILogger _logger; diff --git a/TeamOctolings.Octobot/Commands/InfoCommandGroup.cs b/TeamOctolings.Octobot/Commands/InfoCommandGroup.cs index 65ddd53..d7798f3 100644 --- a/TeamOctolings.Octobot/Commands/InfoCommandGroup.cs +++ b/TeamOctolings.Octobot/Commands/InfoCommandGroup.cs @@ -23,7 +23,7 @@ namespace TeamOctolings.Octobot.Commands; /// Handles info commands: /userinfo, /guildinfo. /// [UsedImplicitly] -public class InfoCommandGroup : CommandGroup +public sealed class InfoCommandGroup : CommandGroup { private readonly ICommandContext _context; private readonly IFeedbackService _feedback; diff --git a/TeamOctolings.Octobot/Commands/KickCommandGroup.cs b/TeamOctolings.Octobot/Commands/KickCommandGroup.cs index 4252232..a8fea2a 100644 --- a/TeamOctolings.Octobot/Commands/KickCommandGroup.cs +++ b/TeamOctolings.Octobot/Commands/KickCommandGroup.cs @@ -22,7 +22,7 @@ namespace TeamOctolings.Octobot.Commands; /// Handles the command to kick members of a guild: /kick. /// [UsedImplicitly] -public class KickCommandGroup : CommandGroup +public sealed class KickCommandGroup : CommandGroup { private readonly AccessControlService _access; private readonly IDiscordRestChannelAPI _channelApi; diff --git a/TeamOctolings.Octobot/Commands/MuteCommandGroup.cs b/TeamOctolings.Octobot/Commands/MuteCommandGroup.cs index 8e449f7..282afe8 100644 --- a/TeamOctolings.Octobot/Commands/MuteCommandGroup.cs +++ b/TeamOctolings.Octobot/Commands/MuteCommandGroup.cs @@ -26,7 +26,7 @@ namespace TeamOctolings.Octobot.Commands; /// Handles commands related to mute management: /mute and /unmute. /// [UsedImplicitly] -public class MuteCommandGroup : CommandGroup +public sealed class MuteCommandGroup : CommandGroup { private readonly AccessControlService _access; private readonly ICommandContext _context; diff --git a/TeamOctolings.Octobot/Commands/PingCommandGroup.cs b/TeamOctolings.Octobot/Commands/PingCommandGroup.cs index 70b9f23..01a1ee2 100644 --- a/TeamOctolings.Octobot/Commands/PingCommandGroup.cs +++ b/TeamOctolings.Octobot/Commands/PingCommandGroup.cs @@ -22,7 +22,7 @@ namespace TeamOctolings.Octobot.Commands; /// Handles the command to get the time taken for the gateway to respond to the last heartbeat: /ping /// [UsedImplicitly] -public class PingCommandGroup : CommandGroup +public sealed class PingCommandGroup : CommandGroup { private readonly IDiscordRestChannelAPI _channelApi; private readonly DiscordGatewayClient _client; diff --git a/TeamOctolings.Octobot/Commands/RemindCommandGroup.cs b/TeamOctolings.Octobot/Commands/RemindCommandGroup.cs index f40ba6b..bf59d67 100644 --- a/TeamOctolings.Octobot/Commands/RemindCommandGroup.cs +++ b/TeamOctolings.Octobot/Commands/RemindCommandGroup.cs @@ -25,13 +25,13 @@ namespace TeamOctolings.Octobot.Commands; /// Handles commands to manage reminders: /remind, /listremind, /delremind /// [UsedImplicitly] -public class RemindCommandGroup : CommandGroup +public sealed class RemindCommandGroup : CommandGroup { private readonly IInteractionCommandContext _context; private readonly IFeedbackService _feedback; private readonly GuildDataService _guildData; - private readonly IDiscordRestUserAPI _userApi; private readonly IDiscordRestInteractionAPI _interactionApi; + private readonly IDiscordRestUserAPI _userApi; public RemindCommandGroup( IInteractionCommandContext context, GuildDataService guildData, IFeedbackService feedback, diff --git a/TeamOctolings.Octobot/Commands/SettingsCommandGroup.cs b/TeamOctolings.Octobot/Commands/SettingsCommandGroup.cs index 56584bf..0acaa88 100644 --- a/TeamOctolings.Octobot/Commands/SettingsCommandGroup.cs +++ b/TeamOctolings.Octobot/Commands/SettingsCommandGroup.cs @@ -26,7 +26,7 @@ namespace TeamOctolings.Octobot.Commands; /// Handles the commands to list and modify per-guild settings: /settings and /settings list. /// [UsedImplicitly] -public class SettingsCommandGroup : CommandGroup +public sealed class SettingsCommandGroup : CommandGroup { /// /// Represents all options as an array of objects implementing . diff --git a/TeamOctolings.Octobot/Commands/ToolsCommandGroup.cs b/TeamOctolings.Octobot/Commands/ToolsCommandGroup.cs index 6af3040..b4c3488 100644 --- a/TeamOctolings.Octobot/Commands/ToolsCommandGroup.cs +++ b/TeamOctolings.Octobot/Commands/ToolsCommandGroup.cs @@ -22,7 +22,7 @@ namespace TeamOctolings.Octobot.Commands; /// Handles tool commands: /random, /timestamp, /8ball. /// [UsedImplicitly] -public class ToolsCommandGroup : CommandGroup +public sealed class ToolsCommandGroup : CommandGroup { private static readonly TimestampStyle[] AllStyles = [ diff --git a/TeamOctolings.Octobot/Responders/GuildLoadedResponder.cs b/TeamOctolings.Octobot/Responders/GuildLoadedResponder.cs index 0c71a06..cebb1ea 100644 --- a/TeamOctolings.Octobot/Responders/GuildLoadedResponder.cs +++ b/TeamOctolings.Octobot/Responders/GuildLoadedResponder.cs @@ -19,7 +19,7 @@ namespace TeamOctolings.Octobot.Responders; /// has enabled /// [UsedImplicitly] -public class GuildLoadedResponder : IResponder +public sealed class GuildLoadedResponder : IResponder { private readonly IDiscordRestChannelAPI _channelApi; private readonly GuildDataService _guildData; diff --git a/TeamOctolings.Octobot/Responders/GuildMemberJoinedResponder.cs b/TeamOctolings.Octobot/Responders/GuildMemberJoinedResponder.cs index 6964fe7..c1f1da0 100644 --- a/TeamOctolings.Octobot/Responders/GuildMemberJoinedResponder.cs +++ b/TeamOctolings.Octobot/Responders/GuildMemberJoinedResponder.cs @@ -18,7 +18,7 @@ namespace TeamOctolings.Octobot.Responders; /// /// [UsedImplicitly] -public class GuildMemberJoinedResponder : IResponder +public sealed class GuildMemberJoinedResponder : IResponder { private readonly IDiscordRestChannelAPI _channelApi; private readonly IDiscordRestGuildAPI _guildApi; diff --git a/TeamOctolings.Octobot/Responders/GuildMemberLeftResponder.cs b/TeamOctolings.Octobot/Responders/GuildMemberLeftResponder.cs index 4f6150c..9774899 100644 --- a/TeamOctolings.Octobot/Responders/GuildMemberLeftResponder.cs +++ b/TeamOctolings.Octobot/Responders/GuildMemberLeftResponder.cs @@ -15,7 +15,7 @@ namespace TeamOctolings.Octobot.Responders; /// /// [UsedImplicitly] -public class GuildMemberLeftResponder : IResponder +public sealed class GuildMemberLeftResponder : IResponder { private readonly IDiscordRestChannelAPI _channelApi; private readonly IDiscordRestGuildAPI _guildApi; diff --git a/TeamOctolings.Octobot/Responders/GuildUnloadedResponder.cs b/TeamOctolings.Octobot/Responders/GuildUnloadedResponder.cs index a4680d4..c73c134 100644 --- a/TeamOctolings.Octobot/Responders/GuildUnloadedResponder.cs +++ b/TeamOctolings.Octobot/Responders/GuildUnloadedResponder.cs @@ -12,7 +12,7 @@ namespace TeamOctolings.Octobot.Responders; /// Handles removing guild ID from if the guild becomes unavailable. /// [UsedImplicitly] -public class GuildUnloadedResponder : IResponder +public sealed class GuildUnloadedResponder : IResponder { private readonly GuildDataService _guildData; private readonly ILogger _logger; diff --git a/TeamOctolings.Octobot/Responders/MessageDeletedResponder.cs b/TeamOctolings.Octobot/Responders/MessageDeletedResponder.cs index 6b09b8d..88a8de2 100644 --- a/TeamOctolings.Octobot/Responders/MessageDeletedResponder.cs +++ b/TeamOctolings.Octobot/Responders/MessageDeletedResponder.cs @@ -18,7 +18,7 @@ namespace TeamOctolings.Octobot.Responders; /// to a guild's if one is set. /// [UsedImplicitly] -public class MessageDeletedResponder : IResponder +public sealed class MessageDeletedResponder : IResponder { private readonly IDiscordRestAuditLogAPI _auditLogApi; private readonly IDiscordRestChannelAPI _channelApi; diff --git a/TeamOctolings.Octobot/Responders/MessageEditedResponder.cs b/TeamOctolings.Octobot/Responders/MessageEditedResponder.cs index 6134214..2968562 100644 --- a/TeamOctolings.Octobot/Responders/MessageEditedResponder.cs +++ b/TeamOctolings.Octobot/Responders/MessageEditedResponder.cs @@ -20,7 +20,7 @@ namespace TeamOctolings.Octobot.Responders; /// to a guild's if one is set. /// [UsedImplicitly] -public class MessageEditedResponder : IResponder +public sealed class MessageEditedResponder : IResponder { private readonly CacheService _cacheService; private readonly IDiscordRestChannelAPI _channelApi; diff --git a/TeamOctolings.Octobot/Responders/MessageReceivedResponder.cs b/TeamOctolings.Octobot/Responders/MessageReceivedResponder.cs index 34a8f5c..24d53a5 100644 --- a/TeamOctolings.Octobot/Responders/MessageReceivedResponder.cs +++ b/TeamOctolings.Octobot/Responders/MessageReceivedResponder.cs @@ -11,7 +11,7 @@ namespace TeamOctolings.Octobot.Responders; /// Handles sending replies to easter egg messages. /// [UsedImplicitly] -public class MessageCreateResponder : IResponder +public sealed class MessageCreateResponder : IResponder { private readonly IDiscordRestChannelAPI _channelApi;