From 5f0d8062137afc3d3fef1a8fd04ab270181b4fed Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Sat, 4 Nov 2023 23:28:22 +0500 Subject: [PATCH] Use IFeedbackService interface instead of implementation (#178) This PR replaces usages of the `FeedbackService` implementation with the `IFeedbackService` interface. Using concrete implementations breaks the whole point of dependency injection, so it doesn't make sense to use them --- src/Commands/AboutCommandGroup.cs | 4 ++-- src/Commands/BanCommandGroup.cs | 4 ++-- src/Commands/ClearCommandGroup.cs | 4 ++-- src/Commands/Events/ErrorLoggingPostExecutionEvent.cs | 4 ++-- src/Commands/KickCommandGroup.cs | 4 ++-- src/Commands/MuteCommandGroup.cs | 4 ++-- src/Commands/PingCommandGroup.cs | 4 ++-- src/Commands/RemindCommandGroup.cs | 4 ++-- src/Commands/SettingsCommandGroup.cs | 4 ++-- src/Commands/ToolsCommandGroup.cs | 4 ++-- src/Extensions/FeedbackServiceExtensions.cs | 2 +- 11 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Commands/AboutCommandGroup.cs b/src/Commands/AboutCommandGroup.cs index 8529d48..8bfc881 100644 --- a/src/Commands/AboutCommandGroup.cs +++ b/src/Commands/AboutCommandGroup.cs @@ -32,14 +32,14 @@ public class AboutCommandGroup : CommandGroup }; private readonly ICommandContext _context; - private readonly FeedbackService _feedback; + private readonly IFeedbackService _feedback; private readonly GuildDataService _guildData; private readonly IDiscordRestUserAPI _userApi; private readonly IDiscordRestGuildAPI _guildApi; public AboutCommandGroup( ICommandContext context, GuildDataService guildData, - FeedbackService feedback, IDiscordRestUserAPI userApi, + IFeedbackService feedback, IDiscordRestUserAPI userApi, IDiscordRestGuildAPI guildApi) { _context = context; diff --git a/src/Commands/BanCommandGroup.cs b/src/Commands/BanCommandGroup.cs index 91668ec..575e709 100644 --- a/src/Commands/BanCommandGroup.cs +++ b/src/Commands/BanCommandGroup.cs @@ -29,7 +29,7 @@ public class BanCommandGroup : CommandGroup { private readonly IDiscordRestChannelAPI _channelApi; private readonly ICommandContext _context; - private readonly FeedbackService _feedback; + private readonly IFeedbackService _feedback; private readonly IDiscordRestGuildAPI _guildApi; private readonly GuildDataService _guildData; private readonly IDiscordRestUserAPI _userApi; @@ -37,7 +37,7 @@ public class BanCommandGroup : CommandGroup public BanCommandGroup( ICommandContext context, IDiscordRestChannelAPI channelApi, GuildDataService guildData, - FeedbackService feedback, IDiscordRestGuildAPI guildApi, IDiscordRestUserAPI userApi, + IFeedbackService feedback, IDiscordRestGuildAPI guildApi, IDiscordRestUserAPI userApi, UtilityService utility) { _context = context; diff --git a/src/Commands/ClearCommandGroup.cs b/src/Commands/ClearCommandGroup.cs index 714c9de..8e1f90d 100644 --- a/src/Commands/ClearCommandGroup.cs +++ b/src/Commands/ClearCommandGroup.cs @@ -27,14 +27,14 @@ public class ClearCommandGroup : CommandGroup { private readonly IDiscordRestChannelAPI _channelApi; private readonly ICommandContext _context; - private readonly FeedbackService _feedback; + private readonly IFeedbackService _feedback; private readonly GuildDataService _guildData; private readonly IDiscordRestUserAPI _userApi; private readonly UtilityService _utility; public ClearCommandGroup( IDiscordRestChannelAPI channelApi, ICommandContext context, GuildDataService guildData, - FeedbackService feedback, IDiscordRestUserAPI userApi, UtilityService utility) + IFeedbackService feedback, IDiscordRestUserAPI userApi, UtilityService utility) { _channelApi = channelApi; _context = context; diff --git a/src/Commands/Events/ErrorLoggingPostExecutionEvent.cs b/src/Commands/Events/ErrorLoggingPostExecutionEvent.cs index a6daaf0..426fd35 100644 --- a/src/Commands/Events/ErrorLoggingPostExecutionEvent.cs +++ b/src/Commands/Events/ErrorLoggingPostExecutionEvent.cs @@ -18,10 +18,10 @@ namespace Octobot.Commands.Events; public class ErrorLoggingPostExecutionEvent : IPostExecutionEvent { private readonly ILogger _logger; - private readonly FeedbackService _feedback; + private readonly IFeedbackService _feedback; private readonly IDiscordRestUserAPI _userApi; - public ErrorLoggingPostExecutionEvent(ILogger logger, FeedbackService feedback, + public ErrorLoggingPostExecutionEvent(ILogger logger, IFeedbackService feedback, IDiscordRestUserAPI userApi) { _logger = logger; diff --git a/src/Commands/KickCommandGroup.cs b/src/Commands/KickCommandGroup.cs index 9d9f745..25fe1b5 100644 --- a/src/Commands/KickCommandGroup.cs +++ b/src/Commands/KickCommandGroup.cs @@ -26,7 +26,7 @@ public class KickCommandGroup : CommandGroup { private readonly IDiscordRestChannelAPI _channelApi; private readonly ICommandContext _context; - private readonly FeedbackService _feedback; + private readonly IFeedbackService _feedback; private readonly IDiscordRestGuildAPI _guildApi; private readonly GuildDataService _guildData; private readonly IDiscordRestUserAPI _userApi; @@ -34,7 +34,7 @@ public class KickCommandGroup : CommandGroup public KickCommandGroup( ICommandContext context, IDiscordRestChannelAPI channelApi, GuildDataService guildData, - FeedbackService feedback, IDiscordRestGuildAPI guildApi, IDiscordRestUserAPI userApi, + IFeedbackService feedback, IDiscordRestGuildAPI guildApi, IDiscordRestUserAPI userApi, UtilityService utility) { _context = context; diff --git a/src/Commands/MuteCommandGroup.cs b/src/Commands/MuteCommandGroup.cs index 533edef..e431a53 100644 --- a/src/Commands/MuteCommandGroup.cs +++ b/src/Commands/MuteCommandGroup.cs @@ -28,14 +28,14 @@ namespace Octobot.Commands; public class MuteCommandGroup : CommandGroup { private readonly ICommandContext _context; - private readonly FeedbackService _feedback; + private readonly IFeedbackService _feedback; private readonly IDiscordRestGuildAPI _guildApi; private readonly GuildDataService _guildData; private readonly IDiscordRestUserAPI _userApi; private readonly UtilityService _utility; public MuteCommandGroup( - ICommandContext context, GuildDataService guildData, FeedbackService feedback, + ICommandContext context, GuildDataService guildData, IFeedbackService feedback, IDiscordRestGuildAPI guildApi, IDiscordRestUserAPI userApi, UtilityService utility) { _context = context; diff --git a/src/Commands/PingCommandGroup.cs b/src/Commands/PingCommandGroup.cs index 293fbff..84b15a0 100644 --- a/src/Commands/PingCommandGroup.cs +++ b/src/Commands/PingCommandGroup.cs @@ -27,13 +27,13 @@ public class PingCommandGroup : CommandGroup private readonly IDiscordRestChannelAPI _channelApi; private readonly DiscordGatewayClient _client; private readonly ICommandContext _context; - private readonly FeedbackService _feedback; + private readonly IFeedbackService _feedback; private readonly GuildDataService _guildData; private readonly IDiscordRestUserAPI _userApi; public PingCommandGroup( IDiscordRestChannelAPI channelApi, ICommandContext context, DiscordGatewayClient client, - GuildDataService guildData, FeedbackService feedback, IDiscordRestUserAPI userApi) + GuildDataService guildData, IFeedbackService feedback, IDiscordRestUserAPI userApi) { _channelApi = channelApi; _context = context; diff --git a/src/Commands/RemindCommandGroup.cs b/src/Commands/RemindCommandGroup.cs index db80eab..6e4d31b 100644 --- a/src/Commands/RemindCommandGroup.cs +++ b/src/Commands/RemindCommandGroup.cs @@ -27,12 +27,12 @@ namespace Octobot.Commands; public class RemindCommandGroup : CommandGroup { private readonly ICommandContext _context; - private readonly FeedbackService _feedback; + private readonly IFeedbackService _feedback; private readonly GuildDataService _guildData; private readonly IDiscordRestUserAPI _userApi; public RemindCommandGroup( - ICommandContext context, GuildDataService guildData, FeedbackService feedback, + ICommandContext context, GuildDataService guildData, IFeedbackService feedback, IDiscordRestUserAPI userApi) { _context = context; diff --git a/src/Commands/SettingsCommandGroup.cs b/src/Commands/SettingsCommandGroup.cs index b1f9b95..2c114c1 100644 --- a/src/Commands/SettingsCommandGroup.cs +++ b/src/Commands/SettingsCommandGroup.cs @@ -54,14 +54,14 @@ public class SettingsCommandGroup : CommandGroup }; private readonly ICommandContext _context; - private readonly FeedbackService _feedback; + private readonly IFeedbackService _feedback; private readonly GuildDataService _guildData; private readonly IDiscordRestUserAPI _userApi; private readonly UtilityService _utility; public SettingsCommandGroup( ICommandContext context, GuildDataService guildData, - FeedbackService feedback, IDiscordRestUserAPI userApi, UtilityService utility) + IFeedbackService feedback, IDiscordRestUserAPI userApi, UtilityService utility) { _context = context; _guildData = guildData; diff --git a/src/Commands/ToolsCommandGroup.cs b/src/Commands/ToolsCommandGroup.cs index 6c70c01..c0b99f5 100644 --- a/src/Commands/ToolsCommandGroup.cs +++ b/src/Commands/ToolsCommandGroup.cs @@ -26,13 +26,13 @@ namespace Octobot.Commands; public class ToolsCommandGroup : CommandGroup { private readonly ICommandContext _context; - private readonly FeedbackService _feedback; + private readonly IFeedbackService _feedback; private readonly IDiscordRestGuildAPI _guildApi; private readonly GuildDataService _guildData; private readonly IDiscordRestUserAPI _userApi; public ToolsCommandGroup( - ICommandContext context, FeedbackService feedback, + ICommandContext context, IFeedbackService feedback, GuildDataService guildData, IDiscordRestGuildAPI guildApi, IDiscordRestUserAPI userApi, IDiscordRestChannelAPI channelApi) { diff --git a/src/Extensions/FeedbackServiceExtensions.cs b/src/Extensions/FeedbackServiceExtensions.cs index 401a865..739aa34 100644 --- a/src/Extensions/FeedbackServiceExtensions.cs +++ b/src/Extensions/FeedbackServiceExtensions.cs @@ -7,7 +7,7 @@ namespace Octobot.Extensions; public static class FeedbackServiceExtensions { public static async Task SendContextualEmbedResultAsync( - this FeedbackService feedback, Result embedResult, CancellationToken ct = default) + this IFeedbackService feedback, Result embedResult, CancellationToken ct = default) { if (!embedResult.IsDefined(out var embed)) {