1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-01-31 09:09:00 +03:00

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 <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2024-05-23 17:47:51 +05:00 committed by GitHub
parent ebcdcb35f7
commit d03e2504fc
Signed by: GitHub
GPG key ID: B5690EEEBB952194
19 changed files with 21 additions and 21 deletions

View file

@ -25,7 +25,7 @@ namespace TeamOctolings.Octobot.Commands;
/// Handles the command to show information about this bot: /about. /// Handles the command to show information about this bot: /about.
/// </summary> /// </summary>
[UsedImplicitly] [UsedImplicitly]
public class AboutCommandGroup : CommandGroup public sealed class AboutCommandGroup : CommandGroup
{ {
private static readonly (string Username, Snowflake Id)[] Developers = private static readonly (string Username, Snowflake Id)[] Developers =
[ [
@ -36,9 +36,9 @@ public class AboutCommandGroup : CommandGroup
private readonly ICommandContext _context; private readonly ICommandContext _context;
private readonly IFeedbackService _feedback; private readonly IFeedbackService _feedback;
private readonly IDiscordRestGuildAPI _guildApi;
private readonly GuildDataService _guildData; private readonly GuildDataService _guildData;
private readonly IDiscordRestUserAPI _userApi; private readonly IDiscordRestUserAPI _userApi;
private readonly IDiscordRestGuildAPI _guildApi;
public AboutCommandGroup( public AboutCommandGroup(
ICommandContext context, GuildDataService guildData, ICommandContext context, GuildDataService guildData,

View file

@ -26,7 +26,7 @@ namespace TeamOctolings.Octobot.Commands;
/// Handles commands related to ban management: /ban and /unban. /// Handles commands related to ban management: /ban and /unban.
/// </summary> /// </summary>
[UsedImplicitly] [UsedImplicitly]
public class BanCommandGroup : CommandGroup public sealed class BanCommandGroup : CommandGroup
{ {
private readonly AccessControlService _access; private readonly AccessControlService _access;
private readonly IDiscordRestChannelAPI _channelApi; private readonly IDiscordRestChannelAPI _channelApi;

View file

@ -23,7 +23,7 @@ namespace TeamOctolings.Octobot.Commands;
/// Handles the command to clear messages in a channel: /clear. /// Handles the command to clear messages in a channel: /clear.
/// </summary> /// </summary>
[UsedImplicitly] [UsedImplicitly]
public class ClearCommandGroup : CommandGroup public sealed class ClearCommandGroup : CommandGroup
{ {
private readonly IDiscordRestChannelAPI _channelApi; private readonly IDiscordRestChannelAPI _channelApi;
private readonly ICommandContext _context; private readonly ICommandContext _context;

View file

@ -18,7 +18,7 @@ namespace TeamOctolings.Octobot.Commands.Events;
/// Handles error logging for slash command groups. /// Handles error logging for slash command groups.
/// </summary> /// </summary>
[UsedImplicitly] [UsedImplicitly]
public class ErrorLoggingPostExecutionEvent : IPostExecutionEvent public sealed class ErrorLoggingPostExecutionEvent : IPostExecutionEvent
{ {
private readonly IFeedbackService _feedback; private readonly IFeedbackService _feedback;
private readonly ILogger<ErrorLoggingPostExecutionEvent> _logger; private readonly ILogger<ErrorLoggingPostExecutionEvent> _logger;

View file

@ -11,7 +11,7 @@ namespace TeamOctolings.Octobot.Commands.Events;
/// Handles error logging for slash commands that couldn't be successfully prepared. /// Handles error logging for slash commands that couldn't be successfully prepared.
/// </summary> /// </summary>
[UsedImplicitly] [UsedImplicitly]
public class LoggingPreparationErrorEvent : IPreparationErrorEvent public sealed class LoggingPreparationErrorEvent : IPreparationErrorEvent
{ {
private readonly ILogger<LoggingPreparationErrorEvent> _logger; private readonly ILogger<LoggingPreparationErrorEvent> _logger;

View file

@ -23,7 +23,7 @@ namespace TeamOctolings.Octobot.Commands;
/// Handles info commands: /userinfo, /guildinfo. /// Handles info commands: /userinfo, /guildinfo.
/// </summary> /// </summary>
[UsedImplicitly] [UsedImplicitly]
public class InfoCommandGroup : CommandGroup public sealed class InfoCommandGroup : CommandGroup
{ {
private readonly ICommandContext _context; private readonly ICommandContext _context;
private readonly IFeedbackService _feedback; private readonly IFeedbackService _feedback;

View file

@ -22,7 +22,7 @@ namespace TeamOctolings.Octobot.Commands;
/// Handles the command to kick members of a guild: /kick. /// Handles the command to kick members of a guild: /kick.
/// </summary> /// </summary>
[UsedImplicitly] [UsedImplicitly]
public class KickCommandGroup : CommandGroup public sealed class KickCommandGroup : CommandGroup
{ {
private readonly AccessControlService _access; private readonly AccessControlService _access;
private readonly IDiscordRestChannelAPI _channelApi; private readonly IDiscordRestChannelAPI _channelApi;

View file

@ -26,7 +26,7 @@ namespace TeamOctolings.Octobot.Commands;
/// Handles commands related to mute management: /mute and /unmute. /// Handles commands related to mute management: /mute and /unmute.
/// </summary> /// </summary>
[UsedImplicitly] [UsedImplicitly]
public class MuteCommandGroup : CommandGroup public sealed class MuteCommandGroup : CommandGroup
{ {
private readonly AccessControlService _access; private readonly AccessControlService _access;
private readonly ICommandContext _context; private readonly ICommandContext _context;

View file

@ -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 /// Handles the command to get the time taken for the gateway to respond to the last heartbeat: /ping
/// </summary> /// </summary>
[UsedImplicitly] [UsedImplicitly]
public class PingCommandGroup : CommandGroup public sealed class PingCommandGroup : CommandGroup
{ {
private readonly IDiscordRestChannelAPI _channelApi; private readonly IDiscordRestChannelAPI _channelApi;
private readonly DiscordGatewayClient _client; private readonly DiscordGatewayClient _client;

View file

@ -25,13 +25,13 @@ namespace TeamOctolings.Octobot.Commands;
/// Handles commands to manage reminders: /remind, /listremind, /delremind /// Handles commands to manage reminders: /remind, /listremind, /delremind
/// </summary> /// </summary>
[UsedImplicitly] [UsedImplicitly]
public class RemindCommandGroup : CommandGroup public sealed class RemindCommandGroup : CommandGroup
{ {
private readonly IInteractionCommandContext _context; private readonly IInteractionCommandContext _context;
private readonly IFeedbackService _feedback; private readonly IFeedbackService _feedback;
private readonly GuildDataService _guildData; private readonly GuildDataService _guildData;
private readonly IDiscordRestUserAPI _userApi;
private readonly IDiscordRestInteractionAPI _interactionApi; private readonly IDiscordRestInteractionAPI _interactionApi;
private readonly IDiscordRestUserAPI _userApi;
public RemindCommandGroup( public RemindCommandGroup(
IInteractionCommandContext context, GuildDataService guildData, IFeedbackService feedback, IInteractionCommandContext context, GuildDataService guildData, IFeedbackService feedback,

View file

@ -26,7 +26,7 @@ namespace TeamOctolings.Octobot.Commands;
/// Handles the commands to list and modify per-guild settings: /settings and /settings list. /// Handles the commands to list and modify per-guild settings: /settings and /settings list.
/// </summary> /// </summary>
[UsedImplicitly] [UsedImplicitly]
public class SettingsCommandGroup : CommandGroup public sealed class SettingsCommandGroup : CommandGroup
{ {
/// <summary> /// <summary>
/// Represents all options as an array of objects implementing <see cref="IGuildOption" />. /// Represents all options as an array of objects implementing <see cref="IGuildOption" />.

View file

@ -22,7 +22,7 @@ namespace TeamOctolings.Octobot.Commands;
/// Handles tool commands: /random, /timestamp, /8ball. /// Handles tool commands: /random, /timestamp, /8ball.
/// </summary> /// </summary>
[UsedImplicitly] [UsedImplicitly]
public class ToolsCommandGroup : CommandGroup public sealed class ToolsCommandGroup : CommandGroup
{ {
private static readonly TimestampStyle[] AllStyles = private static readonly TimestampStyle[] AllStyles =
[ [

View file

@ -19,7 +19,7 @@ namespace TeamOctolings.Octobot.Responders;
/// has <see cref="GuildSettings.ReceiveStartupMessages" /> enabled /// has <see cref="GuildSettings.ReceiveStartupMessages" /> enabled
/// </summary> /// </summary>
[UsedImplicitly] [UsedImplicitly]
public class GuildLoadedResponder : IResponder<IGuildCreate> public sealed class GuildLoadedResponder : IResponder<IGuildCreate>
{ {
private readonly IDiscordRestChannelAPI _channelApi; private readonly IDiscordRestChannelAPI _channelApi;
private readonly GuildDataService _guildData; private readonly GuildDataService _guildData;

View file

@ -18,7 +18,7 @@ namespace TeamOctolings.Octobot.Responders;
/// </summary> /// </summary>
/// <seealso cref="GuildSettings.WelcomeMessage" /> /// <seealso cref="GuildSettings.WelcomeMessage" />
[UsedImplicitly] [UsedImplicitly]
public class GuildMemberJoinedResponder : IResponder<IGuildMemberAdd> public sealed class GuildMemberJoinedResponder : IResponder<IGuildMemberAdd>
{ {
private readonly IDiscordRestChannelAPI _channelApi; private readonly IDiscordRestChannelAPI _channelApi;
private readonly IDiscordRestGuildAPI _guildApi; private readonly IDiscordRestGuildAPI _guildApi;

View file

@ -15,7 +15,7 @@ namespace TeamOctolings.Octobot.Responders;
/// </summary> /// </summary>
/// <seealso cref="GuildSettings.LeaveMessage" /> /// <seealso cref="GuildSettings.LeaveMessage" />
[UsedImplicitly] [UsedImplicitly]
public class GuildMemberLeftResponder : IResponder<IGuildMemberRemove> public sealed class GuildMemberLeftResponder : IResponder<IGuildMemberRemove>
{ {
private readonly IDiscordRestChannelAPI _channelApi; private readonly IDiscordRestChannelAPI _channelApi;
private readonly IDiscordRestGuildAPI _guildApi; private readonly IDiscordRestGuildAPI _guildApi;

View file

@ -12,7 +12,7 @@ namespace TeamOctolings.Octobot.Responders;
/// Handles removing guild ID from <see cref="GuildData" /> if the guild becomes unavailable. /// Handles removing guild ID from <see cref="GuildData" /> if the guild becomes unavailable.
/// </summary> /// </summary>
[UsedImplicitly] [UsedImplicitly]
public class GuildUnloadedResponder : IResponder<IGuildDelete> public sealed class GuildUnloadedResponder : IResponder<IGuildDelete>
{ {
private readonly GuildDataService _guildData; private readonly GuildDataService _guildData;
private readonly ILogger<GuildUnloadedResponder> _logger; private readonly ILogger<GuildUnloadedResponder> _logger;

View file

@ -18,7 +18,7 @@ namespace TeamOctolings.Octobot.Responders;
/// to a guild's <see cref="GuildSettings.PrivateFeedbackChannel" /> if one is set. /// to a guild's <see cref="GuildSettings.PrivateFeedbackChannel" /> if one is set.
/// </summary> /// </summary>
[UsedImplicitly] [UsedImplicitly]
public class MessageDeletedResponder : IResponder<IMessageDelete> public sealed class MessageDeletedResponder : IResponder<IMessageDelete>
{ {
private readonly IDiscordRestAuditLogAPI _auditLogApi; private readonly IDiscordRestAuditLogAPI _auditLogApi;
private readonly IDiscordRestChannelAPI _channelApi; private readonly IDiscordRestChannelAPI _channelApi;

View file

@ -20,7 +20,7 @@ namespace TeamOctolings.Octobot.Responders;
/// to a guild's <see cref="GuildSettings.PrivateFeedbackChannel" /> if one is set. /// to a guild's <see cref="GuildSettings.PrivateFeedbackChannel" /> if one is set.
/// </summary> /// </summary>
[UsedImplicitly] [UsedImplicitly]
public class MessageEditedResponder : IResponder<IMessageUpdate> public sealed class MessageEditedResponder : IResponder<IMessageUpdate>
{ {
private readonly CacheService _cacheService; private readonly CacheService _cacheService;
private readonly IDiscordRestChannelAPI _channelApi; private readonly IDiscordRestChannelAPI _channelApi;

View file

@ -11,7 +11,7 @@ namespace TeamOctolings.Octobot.Responders;
/// Handles sending replies to easter egg messages. /// Handles sending replies to easter egg messages.
/// </summary> /// </summary>
[UsedImplicitly] [UsedImplicitly]
public class MessageCreateResponder : IResponder<IMessageCreate> public sealed class MessageCreateResponder : IResponder<IMessageCreate>
{ {
private readonly IDiscordRestChannelAPI _channelApi; private readonly IDiscordRestChannelAPI _channelApi;