32 lines
986 B
C#
32 lines
986 B
C#
|
|
using OneOf;
|
||
|
|
using Remora.Discord.API.Abstractions.Objects;
|
||
|
|
using Remora.Discord.API.Abstractions.Rest;
|
||
|
|
using Remora.Discord.API.Objects;
|
||
|
|
using Remora.Rest.Core;
|
||
|
|
using Remora.Results;
|
||
|
|
|
||
|
|
namespace Catalogger.Backend.Extensions;
|
||
|
|
|
||
|
|
public static class DiscordRestExtensions
|
||
|
|
{
|
||
|
|
public static async Task<Result> UpdateMessageAsync(
|
||
|
|
this IDiscordRestInteractionAPI interactionApi,
|
||
|
|
IInteraction interaction,
|
||
|
|
InteractionMessageCallbackData data
|
||
|
|
) =>
|
||
|
|
await interactionApi.CreateInteractionResponseAsync(
|
||
|
|
interaction.ID,
|
||
|
|
interaction.Token,
|
||
|
|
new InteractionResponse(
|
||
|
|
InteractionCallbackType.UpdateMessage,
|
||
|
|
new Optional<
|
||
|
|
OneOf<
|
||
|
|
IInteractionMessageCallbackData,
|
||
|
|
IInteractionAutocompleteCallbackData,
|
||
|
|
IInteractionModalCallbackData
|
||
|
|
>
|
||
|
|
>(data)
|
||
|
|
)
|
||
|
|
);
|
||
|
|
}
|