1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-05-13 17:26:08 +03:00
Octobot/src/Extensions/FeedbackServiceExtensions.cs
Octol1ttle 5f0d806213
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
2023-11-04 23:28:22 +05:00

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);
}
}