* Fixed unnecesary configuring of TelegraotrOptions inside Builder
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
using Telegram.Bot;
|
using Telegram.Bot;
|
||||||
using Telegram.Bot.Polling;
|
using Telegram.Bot.Polling;
|
||||||
using Telegrator.Hosting;
|
using Telegrator.Hosting;
|
||||||
@@ -71,11 +72,11 @@ namespace Telegrator.Hosting
|
|||||||
|
|
||||||
if (!_settings.DisableAutoConfigure)
|
if (!_settings.DisableAutoConfigure)
|
||||||
{
|
{
|
||||||
Services.Configure<TelegratorOptions>(Configuration.GetSection(nameof(TelegratorOptions)));
|
|
||||||
Services.Configure<ReceiverOptions>(Configuration.GetSection(nameof(ReceiverOptions)));
|
Services.Configure<ReceiverOptions>(Configuration.GetSection(nameof(ReceiverOptions)));
|
||||||
Services.Configure<TelegramBotClientOptions>(Configuration.GetSection(nameof(TelegramBotClientOptions)), new TelegramBotClientOptionsProxy());
|
Services.Configure<TelegramBotClientOptions>(Configuration.GetSection(nameof(TelegramBotClientOptions)), new TelegramBotClientOptionsProxy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Services.AddSingleton<IOptions<TelegratorOptions>>(Options.Create(_settings));
|
||||||
return new TelegramBotHost(_innerBuilder, _handlers);
|
return new TelegramBotHost(_innerBuilder, _handlers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user