* Architectural rework
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Telegrator.Hosting.Configuration
|
||||
namespace Telegrator
|
||||
{
|
||||
/// <summary>
|
||||
/// Abstract base class for configuring options from configuration sources.
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
using Telegrator.MadiatorCore;
|
||||
using Telegrator.Providers;
|
||||
|
||||
namespace Telegrator.Hosting.Providers.Components
|
||||
namespace Telegrator.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Collection class for managing handler descriptors organized by update type for host apps.
|
||||
+3
-1
@@ -1,4 +1,6 @@
|
||||
namespace Telegrator.Hosting.Components
|
||||
using Telegrator.Hosting;
|
||||
|
||||
namespace Telegrator.Handlers
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface for pre-building routines that can be executed during host construction.
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Types;
|
||||
using Telegrator.Configuration;
|
||||
using Telegrator.Core;
|
||||
|
||||
namespace Telegrator.Hosting
|
||||
{
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Telegrator;
|
||||
|
||||
namespace Telegrator.Hosting.Components
|
||||
namespace Telegrator.Hosting
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface for Telegram bot hosts.
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Telegrator.MadiatorCore;
|
||||
using Telegrator.Core;
|
||||
|
||||
namespace Telegrator.Hosting.Components
|
||||
namespace Telegrator.Hosting
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface for building Telegram bot hosts with dependency injection support.
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Telegrator.Hosting.Components;
|
||||
using Telegrator.MadiatorCore;
|
||||
using Telegrator.Core;
|
||||
|
||||
namespace Telegrator.Hosting
|
||||
{
|
||||
+1
-2
@@ -2,9 +2,8 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Telegrator.Hosting.Components;
|
||||
using Telegrator.Core;
|
||||
using Telegrator.Hosting.Providers;
|
||||
using Telegrator.MadiatorCore;
|
||||
|
||||
#pragma warning disable IDE0001
|
||||
namespace Telegrator.Hosting
|
||||
@@ -1,7 +1,6 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Telegrator.Logging;
|
||||
|
||||
namespace Telegrator.Hosting.Logging
|
||||
namespace Telegrator.Logging
|
||||
{
|
||||
/// <summary>
|
||||
/// Adapter for Microsoft.Extensions.Logging to work with Telegrator logging system.
|
||||
@@ -21,7 +20,7 @@ namespace Telegrator.Hosting.Logging
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Log(Telegrator.Logging.LogLevel level, string message, Exception? exception = null)
|
||||
public void Log(LogLevel level, string message, Exception? exception = null)
|
||||
{
|
||||
var msLogLevel = level switch
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
using Telegrator.MadiatorCore;
|
||||
using Telegrator.Polling;
|
||||
using Telegrator.Core;
|
||||
using Telegrator.Mediation;
|
||||
|
||||
namespace Telegrator.Hosting.Polling
|
||||
namespace Telegrator.Polling
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class HostUpdateHandlersPool(IUpdateRouter router, IOptions<TelegratorOptions> options)
|
||||
|
||||
@@ -3,11 +3,10 @@ using Microsoft.Extensions.Options;
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Polling;
|
||||
using Telegram.Bot.Types;
|
||||
using Telegrator.Configuration;
|
||||
using Telegrator.MadiatorCore;
|
||||
using Telegrator.Polling;
|
||||
using Telegrator.Core;
|
||||
using Telegrator.Mediation;
|
||||
|
||||
namespace Telegrator.Hosting.Polling
|
||||
namespace Telegrator.Polling
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class HostUpdateRouter : UpdateRouter
|
||||
|
||||
@@ -3,11 +3,11 @@ using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Polling;
|
||||
using Telegrator.Hosting.Components;
|
||||
using Telegrator.MadiatorCore;
|
||||
using Telegrator.Polling;
|
||||
using Telegrator.Core;
|
||||
using Telegrator.Hosting;
|
||||
using Telegrator.Mediation;
|
||||
|
||||
namespace Telegrator.Hosting.Polling
|
||||
namespace Telegrator.Polling
|
||||
{
|
||||
/// <summary>
|
||||
/// Service for receiving updates for Hosted telegram bots
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Telegrator.Providers;
|
||||
|
||||
namespace Telegrator.Hosting.Providers
|
||||
namespace Telegrator.Providers
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class HostAwaitingProvider(IOptions<TelegratorOptions> options, ILogger<HostAwaitingProvider> logger) : AwaitingProvider(options.Value)
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.Reflection;
|
||||
using Telegrator.Configuration;
|
||||
using Telegrator.Hosting.Components;
|
||||
using Telegrator.Hosting.Providers.Components;
|
||||
using Telegrator.MadiatorCore;
|
||||
using Telegrator.MadiatorCore.Descriptors;
|
||||
using Telegrator.Providers;
|
||||
using Telegrator.Core;
|
||||
using Telegrator.Core.Descriptors;
|
||||
using Telegrator.Hosting;
|
||||
|
||||
namespace Telegrator.Hosting.Providers
|
||||
namespace Telegrator.Providers
|
||||
{
|
||||
/// <summary>
|
||||
/// Pre host building task
|
||||
@@ -16,7 +14,7 @@ namespace Telegrator.Hosting.Providers
|
||||
public delegate void PreBuildingRoutine(ITelegramBotHostBuilder builder);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public class HostHandlersCollection(IServiceCollection hostServiceColletion, ITelegratorOptions options) : HandlersCollection(options), IHostHandlersCollection
|
||||
public class HostHandlersCollection(IServiceCollection hostServiceColletion, TelegratorOptions options) : HandlersCollection(options), IHostHandlersCollection
|
||||
{
|
||||
private readonly IServiceCollection Services = hostServiceColletion;
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Telegrator.Handlers.Components;
|
||||
using Telegrator.MadiatorCore;
|
||||
using Telegrator.MadiatorCore.Descriptors;
|
||||
using Telegrator.Providers;
|
||||
using Telegrator.Core;
|
||||
using Telegrator.Core.Descriptors;
|
||||
using Telegrator.Core.Handlers;
|
||||
|
||||
namespace Telegrator.Hosting.Providers
|
||||
namespace Telegrator.Providers
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class HostHandlersProvider : HandlersProvider
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
using Telegram.Bot;
|
||||
|
||||
namespace Telegrator.Hosting.Configuration
|
||||
namespace Telegrator
|
||||
{
|
||||
/// <summary>
|
||||
/// Internal proxy class for configuring Telegram bot client options from configuration.
|
||||
@@ -5,6 +5,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<RootNamespace>Telegrator</RootNamespace>
|
||||
<BaseOutputPath>..\..\bin</BaseOutputPath>
|
||||
<DocumentationFile>..\..\docs\$(AssemblyName).xml</DocumentationFile>
|
||||
|
||||
|
||||
@@ -12,18 +12,17 @@ using Telegram.Bot;
|
||||
using Telegram.Bot.Polling;
|
||||
using Telegram.Bot.Types;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
using Telegrator.Configuration;
|
||||
using Telegrator.Hosting.Components;
|
||||
using Telegrator;
|
||||
using Telegrator.Core;
|
||||
using Telegrator.Core.Descriptors;
|
||||
using Telegrator.Handlers;
|
||||
using Telegrator.Hosting;
|
||||
using Telegrator.Hosting.Configuration;
|
||||
using Telegrator.Hosting.Logging;
|
||||
using Telegrator.Hosting.Polling;
|
||||
using Telegrator.Hosting.Providers;
|
||||
using Telegrator.Hosting.Providers.Components;
|
||||
using Telegrator.Logging;
|
||||
using Telegrator.MadiatorCore;
|
||||
using Telegrator.MadiatorCore.Descriptors;
|
||||
using Telegrator.Polling;
|
||||
using Telegrator.Providers;
|
||||
|
||||
namespace Telegrator.Hosting
|
||||
namespace Telegrator
|
||||
{
|
||||
public static class HostBuilderExtensions
|
||||
{
|
||||
@@ -196,7 +195,7 @@ namespace Telegrator.Hosting
|
||||
ILogger logger = loggerFactory.CreateLogger("Telegrator");
|
||||
|
||||
MicrosoftLoggingAdapter adapter = new MicrosoftLoggingAdapter(logger);
|
||||
Alligator.AddAdapter(adapter);
|
||||
TelegratorLogging.AddAdapter(adapter);
|
||||
return host;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user