30 lines
1.1 KiB
C#
30 lines
1.1 KiB
C#
using System.Drawing;
|
|
using Remora.Discord.API.Objects;
|
|
using Remora.Discord.Commands.Feedback.Messages;
|
|
using Remora.Discord.Commands.Feedback.Services;
|
|
using Remora.Results;
|
|
|
|
namespace Cassette.Extensions;
|
|
|
|
public static class FeedbackServiceExtensions
|
|
{
|
|
public static async Task<Result> SendContextualMessageResult(
|
|
this IFeedbackService feedbackService, string message, Color? color = null)
|
|
{
|
|
return (Result)await feedbackService.SendContextualMessageAsync(
|
|
new FeedbackMessage(message, color ?? feedbackService.Theme.Secondary));
|
|
}
|
|
|
|
public static async Task<Result> SendContextualEmbedResult(
|
|
this IFeedbackService feedbackService, Result<Embed> embedResult,
|
|
FeedbackMessageOptions? options = null, CancellationToken ct = default)
|
|
{
|
|
if (!embedResult.IsDefined(out var embed))
|
|
{
|
|
return Result.FromError(embedResult);
|
|
}
|
|
|
|
return (Result)await feedbackService.SendContextualEmbedAsync(embed, options, ct);
|
|
// @Octol1ttle i didn't stole that i swear
|
|
}
|
|
}
|