* Fixed Result behaviour
* Added AsWClient * Updated examples
This commit is contained in:
@@ -2,28 +2,12 @@
|
||||
using Microsoft.Data.Sqlite;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System.Data.Common;
|
||||
using Telegram.Bot;
|
||||
|
||||
namespace Telegrator;
|
||||
namespace Telegrator.Tests;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
public static void WebApplicationBuilder_Example(string[] args)
|
||||
{
|
||||
WebApplicationBuilder builder = WebApplication.CreateBuilder(new WebApplicationOptions()
|
||||
{
|
||||
Args = args,
|
||||
ApplicationName = "WebApplication example",
|
||||
});
|
||||
|
||||
builder.AddTelegratorWeb(action: builder => builder.Handlers
|
||||
.CollectHandlersAssemblyWide());
|
||||
|
||||
builder.Build()
|
||||
.UseTelegratorWeb(dontMap: true)
|
||||
.RemapWebhook("https://amazing-butt-sex.cloudpub.ru/")
|
||||
.Run();
|
||||
}
|
||||
|
||||
public static void HostApplicationBuilder_Example(string[] args)
|
||||
{
|
||||
HostApplicationBuilder builder = Host.CreateApplicationBuilder(new HostApplicationBuilderSettings()
|
||||
@@ -49,7 +33,8 @@ internal static class Program
|
||||
});
|
||||
|
||||
using DbConnection connection = new SqliteConnection(@"Data Source=wtgb.db");
|
||||
builder.Services.ConfigureWideTelegram(new Telegram.Bot.WTelegramBotClientOptions(token: "BOT_TOKEN", apiId: 123, apiHash: "API_HASH", dbConnection: connection));
|
||||
builder.Services.ConfigureWideTelegram(
|
||||
new WTelegramBotClientOptions(token: "BOT_TOKEN", apiId: 123, apiHash: "API_HASH", dbConnection: connection));
|
||||
|
||||
builder.AddWideTelegrator(action: builder => builder.Handlers
|
||||
.CollectHandlersAssemblyWide());
|
||||
@@ -58,4 +43,21 @@ internal static class Program
|
||||
.UseWideTelegrator()
|
||||
.Run();
|
||||
}
|
||||
|
||||
public static void WebApplicationBuilder_Example(string[] args)
|
||||
{
|
||||
WebApplicationBuilder builder = WebApplication.CreateBuilder(new WebApplicationOptions()
|
||||
{
|
||||
Args = args,
|
||||
ApplicationName = "WebApplication example",
|
||||
});
|
||||
|
||||
builder.AddTelegratorWeb(action: builder => builder.Handlers
|
||||
.CollectHandlersAssemblyWide());
|
||||
|
||||
builder.Build()
|
||||
.UseTelegratorWeb(dontMap: true)
|
||||
.RemapWebhook("https://amazing-butt-sex.cloudpub.ru/")
|
||||
.Run();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user