2020-03-02 08:49:57 +04:00
|
|
|
using System;
|
|
|
|
|
using BotFramework;
|
|
|
|
|
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;
|
|
|
|
|
using Telegram.Bot.Types;
|
|
|
|
|
|
|
|
|
|
namespace Kruzya.TelegramBot.RichSiteSummary
|
|
|
|
|
{
|
|
|
|
|
public class RichSiteSummary : Module
|
|
|
|
|
{
|
|
|
|
|
public RichSiteSummary(Core.Core core) : base(core)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void ConfigureServices(IServiceCollection services)
|
|
|
|
|
{
|
|
|
|
|
services.AddDbContext<RichSiteSummaryContext>(options =>
|
|
|
|
|
options.UseLazyLoadingProxies()
|
|
|
|
|
.UseMySql(Configuration.GetConnectionString("RichSiteSummary")));
|
|
|
|
|
|
|
|
|
|
services.AddTelegramBotParameterParser<Feed, DbResolverParameter<Feed, RichSiteSummaryContext>>()
|
|
|
|
|
.AddTelegramBotParameterParser<Post, DbResolverParameter<Post, RichSiteSummaryContext>>()
|
|
|
|
|
.AddTelegramBotParameterParser<Subscriber, DbResolverParameter<Subscriber, RichSiteSummaryContext>>();
|
|
|
|
|
|
|
|
|
|
services.AddQueue<UserMessage>()
|
|
|
|
|
.AddQueue<UserUnsubscribe>();
|
|
|
|
|
|
2020-03-02 18:10:19 +04:00
|
|
|
services.AddHostedService<RssFetch>()
|
|
|
|
|
.AddHostedService<Unsubscriber>()
|
|
|
|
|
.AddHostedService<MessageSender>();
|
2020-03-02 08:49:57 +04:00
|
|
|
}
|
|
|
|
|
}
|
2020-03-02 00:00:52 +04:00
|
|
|
}
|