Initial webhook support

This commit is contained in:
2024-01-28 18:51:18 +03:00
parent aaf27a9a06
commit 1088037e58
4 changed files with 125 additions and 2 deletions
+9 -1
View File
@@ -13,6 +13,7 @@ using Microsoft.Extensions.Logging;
using System.Collections.Concurrent;
using Kruzya.TelegramBot.Core.Options;
using Telegram.Bot.Types;
using BotFramework.Abstractions.UpdateProvider;
namespace Kruzya.TelegramBot.Core;
@@ -49,7 +50,8 @@ public class Startup
services.AddSingleton<IAntiFlood, MemoryAntiFloodService>();
services.AddSingleton<ThreadSafeRandom>();
services.AddSingleton<IWebhookProvider, WebhookAspNetProvider>();
services.AddControllersWithViews();
services.AddSingleton<ConcurrentBag<DeleteRequest>>();
services.AddHostedService<DeleteService>();
@@ -64,6 +66,12 @@ public class Startup
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
_core.Modules.Configure(app, env);
}
}