2026-03-07 20:46:04 +04:00
|
|
|
using Microsoft.AspNetCore.Builder;
|
2026-03-08 19:43:48 +04:00
|
|
|
using Microsoft.Extensions.Configuration;
|
2026-03-07 20:46:04 +04:00
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
|
using Telegrator.Hosting;
|
|
|
|
|
using Telegrator.Hosting.Web;
|
|
|
|
|
|
|
|
|
|
namespace Telegrator;
|
|
|
|
|
|
2026-04-27 09:56:44 +04:00
|
|
|
internal static class Program
|
2026-03-07 20:46:04 +04:00
|
|
|
{
|
|
|
|
|
public static void WebApplicationBuilder_Example(string[] args)
|
|
|
|
|
{
|
|
|
|
|
WebApplicationBuilder builder = WebApplication.CreateBuilder(new WebApplicationOptions()
|
|
|
|
|
{
|
|
|
|
|
Args = args,
|
|
|
|
|
ApplicationName = "WebApplication example",
|
|
|
|
|
});
|
|
|
|
|
|
2026-04-24 00:13:56 +04:00
|
|
|
builder.AddTelegratorWeb(action: builder => builder.Handlers
|
|
|
|
|
.CollectHandlersAssemblyWide());
|
|
|
|
|
|
2026-03-07 20:46:04 +04:00
|
|
|
builder.Build()
|
2026-04-03 19:46:29 +04:00
|
|
|
.UseTelegratorWeb(dontMap: true)
|
2026-04-27 09:56:44 +04:00
|
|
|
.RemapWebhook("https://amazing-butt-sex.cloudpub.ru/")
|
2026-03-07 20:46:04 +04:00
|
|
|
.AddLoggingAdapter()
|
|
|
|
|
.SetBotCommands()
|
|
|
|
|
.Run();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void HostApplicationBuilder_Example(string[] args)
|
|
|
|
|
{
|
|
|
|
|
HostApplicationBuilder builder = Host.CreateApplicationBuilder(new HostApplicationBuilderSettings()
|
|
|
|
|
{
|
|
|
|
|
Args = args,
|
|
|
|
|
ApplicationName = "Host example",
|
|
|
|
|
});
|
|
|
|
|
|
2026-04-24 00:13:56 +04:00
|
|
|
builder.AddTelegrator(action: builder => builder.Handlers
|
|
|
|
|
.CollectHandlersAssemblyWide());
|
2026-03-07 20:46:04 +04:00
|
|
|
|
|
|
|
|
builder.Build()
|
|
|
|
|
.UseTelegrator()
|
|
|
|
|
.AddLoggingAdapter()
|
|
|
|
|
.SetBotCommands()
|
|
|
|
|
.Run();
|
|
|
|
|
}
|
|
|
|
|
}
|