Updated readmes
This commit is contained in:
@@ -41,7 +41,7 @@ using Telegrator.Hosting.Web;
|
||||
TelegramBotWebHostBuilder builder = TelegramBotWebHost.CreateBuilder(new WebApplicationOptions()
|
||||
{
|
||||
Args = args,
|
||||
ApplicationName = "Telegrator WebApplication example",
|
||||
ApplicationName = "TelegramBotWebHost example",
|
||||
});
|
||||
|
||||
// Register handlers
|
||||
@@ -58,6 +58,38 @@ telegramBot.Run();
|
||||
|
||||
---
|
||||
|
||||
## Application integration Example
|
||||
|
||||
**Program.cs (ASP.NET Core):**
|
||||
```csharp
|
||||
using Telegrator.Hosting;
|
||||
using Telegrator.Hosting.Web;
|
||||
|
||||
// Creating builder
|
||||
WebApplicationBuilder builder = WebApplication.CreateBuilder(new WebApplicationOptions()
|
||||
{
|
||||
Args = args,
|
||||
ApplicationName = "WebApplication example",
|
||||
});
|
||||
|
||||
// Adding Telegrator
|
||||
builder.AddTelegratorWeb();
|
||||
|
||||
// Register handlers
|
||||
builder.Handlers.CollectHandlersAssemblyWide();
|
||||
|
||||
// Register your services
|
||||
builder.Services.AddSingleton<IMyService, MyService>();
|
||||
|
||||
// Building and running application
|
||||
builder.Build()
|
||||
.UseTelegratorWeb()
|
||||
.SetBotCommands();
|
||||
.Run();
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Configuration (appsettings.json)
|
||||
|
||||
```json
|
||||
|
||||
@@ -55,6 +55,35 @@ telegramBot.Run();
|
||||
|
||||
---
|
||||
|
||||
## Application integration Example
|
||||
|
||||
**Program.cs:**
|
||||
```csharp
|
||||
using Telegrator.Hosting;
|
||||
|
||||
// Creating builder
|
||||
HostApplicationBuilder builder = Host.CreateApplicationBuilder(new HostApplicationBuilderSettings()
|
||||
{
|
||||
Args = args,
|
||||
ApplicationName = "Host example",
|
||||
});
|
||||
|
||||
// Adding Telegrator
|
||||
builder.AddTelegrator();
|
||||
|
||||
// Registerring handlers (extension)
|
||||
builder.Handlers.CollectHandlersAssemblyWide();
|
||||
|
||||
// Building and running application
|
||||
builder.Build()
|
||||
.UseTelegrator()
|
||||
.SetBotCommands()
|
||||
.Run();
|
||||
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Configuration (appsettings.json)
|
||||
|
||||
```json
|
||||
|
||||
Reference in New Issue
Block a user