* README tweaks

This commit is contained in:
2025-08-02 03:36:48 +04:00
parent 7d1ce6ea22
commit 692f0e0875
3 changed files with 11 additions and 5 deletions
+6 -3
View File
@@ -55,9 +55,10 @@ using Telegrator.Annotations;
[MessageHandler] [MessageHandler]
public class HelloHandler : MessageHandler public class HelloHandler : MessageHandler
{ {
public override async Task Execute(IAbstractHandlerContainer<Message> container, CancellationToken cancellation) public override async Task<Result> Execute(IAbstractHandlerContainer<Message> container, CancellationToken cancellation)
{ {
await Reply("Hello, world!", cancellationToken: cancellation); await Reply("Hello, world!", cancellationToken: cancellation);
return Result.Ok();
} }
} }
@@ -77,9 +78,10 @@ using Telegrator.Annotations;
[CommandHandler, CommandAllias("start", "hello"), ChatType(ChatType.Private)] [CommandHandler, CommandAllias("start", "hello"), ChatType(ChatType.Private)]
public class StartCommandHandler : CommandHandler public class StartCommandHandler : CommandHandler
{ {
public override async Task Execute(IAbstractHandlerContainer<Message> container, CancellationToken cancellation) public override async Task<Result> Execute(IAbstractHandlerContainer<Message> container, CancellationToken cancellation)
{ {
await Responce("Welcome!", cancellationToken: cancellation); await Responce("Welcome!", cancellationToken: cancellation);
return Result.Ok();
} }
} }
@@ -96,11 +98,12 @@ using Telegrator.Annotations;
[CommandHandler, CommandAllias("first"), NumericState(SpecialState.NoState)] [CommandHandler, CommandAllias("first"), NumericState(SpecialState.NoState)]
public class StateKeepFirst : CommandHandler public class StateKeepFirst : CommandHandler
{ {
public override async Task Execute(IAbstractHandlerContainer<Message> container, CancellationToken cancellation) public override async Task<Result> Execute(IAbstractHandlerContainer<Message> container, CancellationToken cancellation)
{ {
container.CreateNumericState(); container.CreateNumericState();
container.ForwardNumericState(); container.ForwardNumericState();
await Reply("first state moved (1)", cancellationToken: cancellation); await Reply("first state moved (1)", cancellationToken: cancellation);
return Result.Ok();
} }
} }
+5 -1
View File
@@ -40,7 +40,6 @@ using Telegrator.Hosting.Web;
TelegramBotWebHostBuilder builder = TelegramBotWebHost.CreateBuilder(new TelegramBotWebOptions() TelegramBotWebHostBuilder builder = TelegramBotWebHost.CreateBuilder(new TelegramBotWebOptions()
{ {
Args = args, Args = args,
WebhookUri = "https://you-public-host.ru/bot"
ExceptIntersectingCommandAliases = true ExceptIntersectingCommandAliases = true
}); });
@@ -66,6 +65,11 @@ telegramBot.Run();
"TelegramBotClientOptions": { "TelegramBotClientOptions": {
"Token": "YOUR_BOT_TOKEN" "Token": "YOUR_BOT_TOKEN"
} }
"TelegratorWebOptions": {
"WebhookUri" = "https://you-public-host.ru/bot",
"DropPendingUpdates": true
}
} }
``` ```
-1
View File
@@ -38,7 +38,6 @@ using Telegrator.Hosting;
TelegramBotHostBuilder builder = TelegramBotHost.CreateBuilder(new TelegramBotHostBuilderSettings() TelegramBotHostBuilder builder = TelegramBotHost.CreateBuilder(new TelegramBotHostBuilderSettings()
{ {
Args = args, Args = args,
DescendDescriptorIndex = false,
ExceptIntersectingCommandAliases = true ExceptIntersectingCommandAliases = true
}); });