39 lines
1.6 KiB
C#
39 lines
1.6 KiB
C#
using BotPages.Core;
|
||
|
||
namespace Demo.Pages
|
||
{
|
||
public sealed class MainPage : Page
|
||
{
|
||
public override string Id => nameof(MainPage);
|
||
|
||
public override Task<PageResult> EnterAsync(UpdateContext ctx, CancellationToken ct)
|
||
{
|
||
var actions = new[]
|
||
{
|
||
new PageAction { Label = "📌 Inline", Value = "inline", Placement = ActionPlacement.Reply, Row = 0 },
|
||
new PageAction { Label = "⌨️ Reply", Value = "reply", Placement = ActionPlacement.Reply, Row = 1 },
|
||
new PageAction { Label = "📂 Файлы", Value = "files", Placement = ActionPlacement.Reply, Row = 2 }
|
||
};
|
||
|
||
return Task.FromResult(
|
||
PageResultBuilder.Empty()
|
||
.WithText("🏠 Главная страница.\nВыберите куда перейти:")
|
||
.WithKeyboard(actions)
|
||
.Build()
|
||
);
|
||
}
|
||
|
||
public override Task<PageResult> HandleAsync(UpdateContext ctx, CancellationToken ct)
|
||
{
|
||
return ctx.Text switch
|
||
{
|
||
"📌 Inline" => Task.FromResult(PageResultBuilder.Empty().WithNavigate(nameof(InlinePage)).Build()),
|
||
"⌨️ Reply" => Task.FromResult(PageResultBuilder.Empty().WithNavigate(nameof(ReplyPage)).Build()),
|
||
"📂 Файлы" => Task.FromResult(PageResultBuilder.Empty().WithNavigate(nameof(FilesPage)).Build()),
|
||
_ => Task.FromResult(PageResultBuilder.Empty().WithText("Выберите действие с кнопок.").Build())
|
||
};
|
||
}
|
||
}
|
||
|
||
}
|