This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
Cassette/Cassette/Extensions/FeedbackServiceExtensions.cs
mctaylors db55ca7fb1
Initial commit
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2023-12-17 04:10:17 +03:00

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