Bugfix to buttons not working when there's only one item, and buy db query

This commit is contained in:
Kwoth
2022-07-26 04:08:37 +02:00
parent 6a042c3faa
commit 516bc1e484
4 changed files with 22 additions and 21 deletions

View File

@@ -0,0 +1,20 @@
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!);
}
}