Files
telegram-bot/modules/RichSiteSummary/RichSiteSummary.cs
T

36 lines
1.4 KiB
C#
Raw Normal View History

2023-07-29 15:03:45 +03:00
using BotFramework;
2020-03-02 08:49:57 +04:00
using Kruzya.TelegramBot.Core;
using Kruzya.TelegramBot.Core.Extensions;
using Kruzya.TelegramBot.RichSiteSummary.Data;
using Kruzya.TelegramBot.RichSiteSummary.Service;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
2023-07-29 15:14:52 +03:00
namespace Kruzya.TelegramBot.RichSiteSummary;
public class RichSiteSummary : Module
2020-03-02 08:49:57 +04:00
{
2023-07-29 15:14:52 +03:00
public RichSiteSummary(Core.Core core) : base(core)
2020-03-02 08:49:57 +04:00
{
2023-07-29 15:14:52 +03:00
}
2020-03-02 08:49:57 +04:00
2023-07-29 15:14:52 +03:00
public override void ConfigureServices(IServiceCollection services)
{
var connectionString = Configuration.GetConnectionString("RichSiteSummary");
services.AddDbContext<RichSiteSummaryContext>(options =>
options.UseLazyLoadingProxies()
.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)));
2020-03-02 08:49:57 +04:00
2023-07-29 15:14:52 +03:00
services.AddTelegramBotParameterParser<Feed, DbResolverParameter<Feed, RichSiteSummaryContext>>()
.AddTelegramBotParameterParser<Post, DbResolverParameter<Post, RichSiteSummaryContext>>()
.AddTelegramBotParameterParser<Subscriber, DbResolverParameter<Subscriber, RichSiteSummaryContext>>();
2020-03-02 08:49:57 +04:00
2023-07-29 15:14:52 +03:00
services.AddQueue<UserMessage>()
.AddQueue<UserUnsubscribe>();
2020-03-02 08:49:57 +04:00
2023-07-29 15:14:52 +03:00
services.AddHostedService<RssFetch>()
.AddHostedService<Unsubscriber>()
.AddHostedService<MessageSender>();
2020-03-02 08:49:57 +04:00
}
2020-03-02 00:00:52 +04:00
}