Files
BotPages/Demo/Pages/ReplyPage.cs

34 lines
1.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using BotPages.Core;
namespace Demo.Pages
{
public sealed class ReplyPage : Page
{
public override string Id => nameof(ReplyPage);
public override Task<PageResult> EnterAsync(UpdateContext ctx, CancellationToken ct)
{
var actions = new[]
{
new PageAction { Label = "⬅️ Назад", Value = "back", Placement = ActionPlacement.Reply, Row = 0 }
};
return Task.FromResult(
PageResultBuilder.Empty()
.WithText("Это страница с Replyклавиатурой.")
.WithKeyboard(actions)
.Build()
);
}
public override Task<PageResult> HandleAsync(UpdateContext ctx, CancellationToken ct)
{
if (ctx.Text == "⬅️ Назад")
return Task.FromResult(PageResultBuilder.Empty().WithNavigate(nameof(MainPage)).Build());
return Task.FromResult(PageResultBuilder.Empty().WithText("Нажмите кнопку 'Назад'.").Build());
}
}
}