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

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
This commit is contained in:
Octol1ttle 2023-11-04 23:28:22 +05:00 committed by GitHub
parent b2879ad35a
commit 5f0d806213
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 21 additions and 21 deletions

View file

@ -32,14 +32,14 @@ public class AboutCommandGroup : CommandGroup
}; };
private readonly ICommandContext _context; private readonly ICommandContext _context;
private readonly FeedbackService _feedback; private readonly IFeedbackService _feedback;
private readonly GuildDataService _guildData; private readonly GuildDataService _guildData;
private readonly IDiscordRestUserAPI _userApi; private readonly IDiscordRestUserAPI _userApi;
private readonly IDiscordRestGuildAPI _guildApi; private readonly IDiscordRestGuildAPI _guildApi;
public AboutCommandGroup( public AboutCommandGroup(
ICommandContext context, GuildDataService guildData, ICommandContext context, GuildDataService guildData,
FeedbackService feedback, IDiscordRestUserAPI userApi, IFeedbackService feedback, IDiscordRestUserAPI userApi,
IDiscordRestGuildAPI guildApi) IDiscordRestGuildAPI guildApi)
{ {
_context = context; _context = context;

View file

@ -29,7 +29,7 @@ public class BanCommandGroup : CommandGroup
{ {
private readonly IDiscordRestChannelAPI _channelApi; private readonly IDiscordRestChannelAPI _channelApi;
private readonly ICommandContext _context; private readonly ICommandContext _context;
private readonly FeedbackService _feedback; private readonly IFeedbackService _feedback;
private readonly IDiscordRestGuildAPI _guildApi; private readonly IDiscordRestGuildAPI _guildApi;
private readonly GuildDataService _guildData; private readonly GuildDataService _guildData;
private readonly IDiscordRestUserAPI _userApi; private readonly IDiscordRestUserAPI _userApi;
@ -37,7 +37,7 @@ public class BanCommandGroup : CommandGroup
public BanCommandGroup( public BanCommandGroup(
ICommandContext context, IDiscordRestChannelAPI channelApi, GuildDataService guildData, ICommandContext context, IDiscordRestChannelAPI channelApi, GuildDataService guildData,
FeedbackService feedback, IDiscordRestGuildAPI guildApi, IDiscordRestUserAPI userApi, IFeedbackService feedback, IDiscordRestGuildAPI guildApi, IDiscordRestUserAPI userApi,
UtilityService utility) UtilityService utility)
{ {
_context = context; _context = context;

View file

@ -27,14 +27,14 @@ public class ClearCommandGroup : CommandGroup
{ {
private readonly IDiscordRestChannelAPI _channelApi; private readonly IDiscordRestChannelAPI _channelApi;
private readonly ICommandContext _context; private readonly ICommandContext _context;
private readonly FeedbackService _feedback; private readonly IFeedbackService _feedback;
private readonly GuildDataService _guildData; private readonly GuildDataService _guildData;
private readonly IDiscordRestUserAPI _userApi; private readonly IDiscordRestUserAPI _userApi;
private readonly UtilityService _utility; private readonly UtilityService _utility;
public ClearCommandGroup( public ClearCommandGroup(
IDiscordRestChannelAPI channelApi, ICommandContext context, GuildDataService guildData, IDiscordRestChannelAPI channelApi, ICommandContext context, GuildDataService guildData,
FeedbackService feedback, IDiscordRestUserAPI userApi, UtilityService utility) IFeedbackService feedback, IDiscordRestUserAPI userApi, UtilityService utility)
{ {
_channelApi = channelApi; _channelApi = channelApi;
_context = context; _context = context;

View file

@ -18,10 +18,10 @@ namespace Octobot.Commands.Events;
public class ErrorLoggingPostExecutionEvent : IPostExecutionEvent public class ErrorLoggingPostExecutionEvent : IPostExecutionEvent
{ {
private readonly ILogger<ErrorLoggingPostExecutionEvent> _logger; private readonly ILogger<ErrorLoggingPostExecutionEvent> _logger;
private readonly FeedbackService _feedback; private readonly IFeedbackService _feedback;
private readonly IDiscordRestUserAPI _userApi; private readonly IDiscordRestUserAPI _userApi;
public ErrorLoggingPostExecutionEvent(ILogger<ErrorLoggingPostExecutionEvent> logger, FeedbackService feedback, public ErrorLoggingPostExecutionEvent(ILogger<ErrorLoggingPostExecutionEvent> logger, IFeedbackService feedback,
IDiscordRestUserAPI userApi) IDiscordRestUserAPI userApi)
{ {
_logger = logger; _logger = logger;

View file

@ -26,7 +26,7 @@ public class KickCommandGroup : CommandGroup
{ {
private readonly IDiscordRestChannelAPI _channelApi; private readonly IDiscordRestChannelAPI _channelApi;
private readonly ICommandContext _context; private readonly ICommandContext _context;
private readonly FeedbackService _feedback; private readonly IFeedbackService _feedback;
private readonly IDiscordRestGuildAPI _guildApi; private readonly IDiscordRestGuildAPI _guildApi;
private readonly GuildDataService _guildData; private readonly GuildDataService _guildData;
private readonly IDiscordRestUserAPI _userApi; private readonly IDiscordRestUserAPI _userApi;
@ -34,7 +34,7 @@ public class KickCommandGroup : CommandGroup
public KickCommandGroup( public KickCommandGroup(
ICommandContext context, IDiscordRestChannelAPI channelApi, GuildDataService guildData, ICommandContext context, IDiscordRestChannelAPI channelApi, GuildDataService guildData,
FeedbackService feedback, IDiscordRestGuildAPI guildApi, IDiscordRestUserAPI userApi, IFeedbackService feedback, IDiscordRestGuildAPI guildApi, IDiscordRestUserAPI userApi,
UtilityService utility) UtilityService utility)
{ {
_context = context; _context = context;

View file

@ -28,14 +28,14 @@ namespace Octobot.Commands;
public class MuteCommandGroup : CommandGroup public class MuteCommandGroup : CommandGroup
{ {
private readonly ICommandContext _context; private readonly ICommandContext _context;
private readonly FeedbackService _feedback; private readonly IFeedbackService _feedback;
private readonly IDiscordRestGuildAPI _guildApi; private readonly IDiscordRestGuildAPI _guildApi;
private readonly GuildDataService _guildData; private readonly GuildDataService _guildData;
private readonly IDiscordRestUserAPI _userApi; private readonly IDiscordRestUserAPI _userApi;
private readonly UtilityService _utility; private readonly UtilityService _utility;
public MuteCommandGroup( public MuteCommandGroup(
ICommandContext context, GuildDataService guildData, FeedbackService feedback, ICommandContext context, GuildDataService guildData, IFeedbackService feedback,
IDiscordRestGuildAPI guildApi, IDiscordRestUserAPI userApi, UtilityService utility) IDiscordRestGuildAPI guildApi, IDiscordRestUserAPI userApi, UtilityService utility)
{ {
_context = context; _context = context;

View file

@ -27,13 +27,13 @@ public class PingCommandGroup : CommandGroup
private readonly IDiscordRestChannelAPI _channelApi; private readonly IDiscordRestChannelAPI _channelApi;
private readonly DiscordGatewayClient _client; private readonly DiscordGatewayClient _client;
private readonly ICommandContext _context; private readonly ICommandContext _context;
private readonly FeedbackService _feedback; private readonly IFeedbackService _feedback;
private readonly GuildDataService _guildData; private readonly GuildDataService _guildData;
private readonly IDiscordRestUserAPI _userApi; private readonly IDiscordRestUserAPI _userApi;
public PingCommandGroup( public PingCommandGroup(
IDiscordRestChannelAPI channelApi, ICommandContext context, DiscordGatewayClient client, IDiscordRestChannelAPI channelApi, ICommandContext context, DiscordGatewayClient client,
GuildDataService guildData, FeedbackService feedback, IDiscordRestUserAPI userApi) GuildDataService guildData, IFeedbackService feedback, IDiscordRestUserAPI userApi)
{ {
_channelApi = channelApi; _channelApi = channelApi;
_context = context; _context = context;

View file

@ -27,12 +27,12 @@ namespace Octobot.Commands;
public class RemindCommandGroup : CommandGroup public class RemindCommandGroup : CommandGroup
{ {
private readonly ICommandContext _context; private readonly ICommandContext _context;
private readonly FeedbackService _feedback; private readonly IFeedbackService _feedback;
private readonly GuildDataService _guildData; private readonly GuildDataService _guildData;
private readonly IDiscordRestUserAPI _userApi; private readonly IDiscordRestUserAPI _userApi;
public RemindCommandGroup( public RemindCommandGroup(
ICommandContext context, GuildDataService guildData, FeedbackService feedback, ICommandContext context, GuildDataService guildData, IFeedbackService feedback,
IDiscordRestUserAPI userApi) IDiscordRestUserAPI userApi)
{ {
_context = context; _context = context;

View file

@ -54,14 +54,14 @@ public class SettingsCommandGroup : CommandGroup
}; };
private readonly ICommandContext _context; private readonly ICommandContext _context;
private readonly FeedbackService _feedback; private readonly IFeedbackService _feedback;
private readonly GuildDataService _guildData; private readonly GuildDataService _guildData;
private readonly IDiscordRestUserAPI _userApi; private readonly IDiscordRestUserAPI _userApi;
private readonly UtilityService _utility; private readonly UtilityService _utility;
public SettingsCommandGroup( public SettingsCommandGroup(
ICommandContext context, GuildDataService guildData, ICommandContext context, GuildDataService guildData,
FeedbackService feedback, IDiscordRestUserAPI userApi, UtilityService utility) IFeedbackService feedback, IDiscordRestUserAPI userApi, UtilityService utility)
{ {
_context = context; _context = context;
_guildData = guildData; _guildData = guildData;

View file

@ -26,13 +26,13 @@ namespace Octobot.Commands;
public class ToolsCommandGroup : CommandGroup public class ToolsCommandGroup : CommandGroup
{ {
private readonly ICommandContext _context; private readonly ICommandContext _context;
private readonly FeedbackService _feedback; private readonly IFeedbackService _feedback;
private readonly IDiscordRestGuildAPI _guildApi; private readonly IDiscordRestGuildAPI _guildApi;
private readonly GuildDataService _guildData; private readonly GuildDataService _guildData;
private readonly IDiscordRestUserAPI _userApi; private readonly IDiscordRestUserAPI _userApi;
public ToolsCommandGroup( public ToolsCommandGroup(
ICommandContext context, FeedbackService feedback, ICommandContext context, IFeedbackService feedback,
GuildDataService guildData, IDiscordRestGuildAPI guildApi, GuildDataService guildData, IDiscordRestGuildAPI guildApi,
IDiscordRestUserAPI userApi, IDiscordRestChannelAPI channelApi) IDiscordRestUserAPI userApi, IDiscordRestChannelAPI channelApi)
{ {

View file

@ -7,7 +7,7 @@ namespace Octobot.Extensions;
public static class FeedbackServiceExtensions public static class FeedbackServiceExtensions
{ {
public static async Task<Result> SendContextualEmbedResultAsync( public static async Task<Result> SendContextualEmbedResultAsync(
this FeedbackService feedback, Result<Embed> embedResult, CancellationToken ct = default) this IFeedbackService feedback, Result<Embed> embedResult, CancellationToken ct = default)
{ {
if (!embedResult.IsDefined(out var embed)) if (!embedResult.IsDefined(out var embed))
{ {