2023-10-12 18:37:25 +03:00
|
|
|
|
using Remora.Discord.API.Objects;
|
2023-12-17 18:44:18 +03:00
|
|
|
|
using Remora.Discord.Commands.Feedback.Messages;
|
2023-10-12 18:37:25 +03:00
|
|
|
|
using Remora.Discord.Commands.Feedback.Services;
|
|
|
|
|
using Remora.Results;
|
|
|
|
|
|
|
|
|
|
namespace Octobot.Extensions;
|
|
|
|
|
|
|
|
|
|
public static class FeedbackServiceExtensions
|
|
|
|
|
{
|
|
|
|
|
public static async Task<Result> SendContextualEmbedResultAsync(
|
2023-12-17 18:44:18 +03:00
|
|
|
|
this IFeedbackService feedback, Result<Embed> embedResult,
|
|
|
|
|
FeedbackMessageOptions? options = null, CancellationToken ct = default)
|
2023-10-12 18:37:25 +03:00
|
|
|
|
{
|
|
|
|
|
if (!embedResult.IsDefined(out var embed))
|
|
|
|
|
{
|
|
|
|
|
return Result.FromError(embedResult);
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-17 18:44:18 +03:00
|
|
|
|
return (Result)await feedback.SendContextualEmbedAsync(embed, options, ct);
|
2023-10-12 18:37:25 +03:00
|
|
|
|
}
|
|
|
|
|
}
|