mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
20 lines
527 B
C#
20 lines
527 B
C#
namespace NadekoBot;
|
|
|
|
public class SimpleInteraction<T>
|
|
{
|
|
public ButtonBuilder Button { get; }
|
|
private readonly Func<SocketMessageComponent, T, Task> _onClick;
|
|
private readonly T? _state;
|
|
|
|
public SimpleInteraction(ButtonBuilder button, Func<SocketMessageComponent, T?, Task> onClick, T? state = default)
|
|
{
|
|
Button = button;
|
|
_onClick = onClick;
|
|
_state = state;
|
|
}
|
|
|
|
public async Task TriggerAsync(SocketMessageComponent smc)
|
|
{
|
|
await _onClick(smc, _state!);
|
|
}
|
|
} |