1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-05-01 03:29:54 +03:00

Remora.Discord part 4 out of ∞ (well that was painful)

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-05-29 22:49:25 +05:00
parent 67a15f3822
commit f7dd09d43e
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
8 changed files with 231 additions and 13 deletions

28
InteractionResponders.cs Normal file
View file

@ -0,0 +1,28 @@
using Remora.Discord.API.Abstractions.Objects;
using Remora.Discord.Commands.Feedback.Messages;
using Remora.Discord.Commands.Feedback.Services;
using Remora.Discord.Interactivity;
using Remora.Results;
// ReSharper disable ClassNeverInstantiated.Global
// ReSharper disable UnusedMember.Global
namespace Boyfriend;
public class InteractionResponders : InteractionGroup {
private readonly FeedbackService _feedbackService;
public InteractionResponders(FeedbackService feedbackService) {
_feedbackService = feedbackService;
}
[Button("scheduled-event-details")]
public async Task<Result> OnStatefulButtonClicked(string? state = null) {
if (state is null) return Result.FromError(new ArgumentNullError(nameof(state)));
var idArray = state.Split(':');
return (Result)await _feedbackService.SendContextualAsync(
$"https://discord.com/events/{idArray[0]}/{idArray[1]}",
options: new FeedbackMessageOptions(MessageFlags: MessageFlags.Ephemeral));
}
}