public async Task <IResult> Test()
    {
        var id        = new Snowflake((ulong)DateTimeOffset.UtcNow.ToUnixTimeMilliseconds());
        var component = new ButtonComponent(ButtonComponentStyle.Primary, "Test",
                                            CustomID: id.ToString());
        var testButton =
            HandleableButton.Create <TestHandler.Command, TestHandler.Context>(id, component,
                                                                               new TestHandler.Context(_context.ChannelID));

        _handlerRepository.Register(testButton);

        return(await _responder.RespondWithComponents(ActionRowUtils.FromButtons(testButton), "Test buttons"));
    }
Exemple #2
0
 /// <inheritdoc />
 public void Register(HandleableButton handleableButton) =>
 Register(handleableButton.Id.Value, handleableButton.Handler);
 public static HandleableButton RegisterWith(this HandleableButton handleableButton, IButtonHandlerRepository repository)
 {
     repository.Register(handleableButton);
     return(handleableButton);
 }