mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-05-13 17:26:08 +03:00
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
19 lines
571 B
C#
19 lines
571 B
C#
using Remora.Discord.API.Objects;
|
|
using Remora.Discord.Commands.Feedback.Services;
|
|
using Remora.Results;
|
|
|
|
namespace Octobot.Extensions;
|
|
|
|
public static class FeedbackServiceExtensions
|
|
{
|
|
public static async Task<Result> SendContextualEmbedResultAsync(
|
|
this IFeedbackService feedback, Result<Embed> embedResult, CancellationToken ct = default)
|
|
{
|
|
if (!embedResult.IsDefined(out var embed))
|
|
{
|
|
return Result.FromError(embedResult);
|
|
}
|
|
|
|
return (Result)await feedback.SendContextualEmbedAsync(embed, ct: ct);
|
|
}
|
|
}
|