* Fixed minor building errors
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Telegrator.MadiatorCore;
|
||||
using Telegrator.Polling;
|
||||
|
||||
namespace Telegrator.Hosting.Polling
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class HostUpdateHandlersPool(IOptions<TelegratorOptions> options, ILogger<HostUpdateHandlersPool> logger) : UpdateHandlersPool(options.Value, options.Value.GlobalCancellationToken)
|
||||
public class HostUpdateHandlersPool(IUpdateRouter router, IOptions<TelegratorOptions> options)
|
||||
: UpdateHandlersPool(router, options.Value, options.Value.GlobalCancellationToken)
|
||||
{
|
||||
private readonly ILogger<HostUpdateHandlersPool> _logger = logger;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>false</IsPackable>
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Telegrator.Handlers
|
||||
int? directMessageTopicId = null,
|
||||
SuggestedPostParameters? suggestedPostParameters = null,
|
||||
CancellationToken cancellationToken = default)
|
||||
=> await Container.Response(
|
||||
=> await Container.Responce(
|
||||
text, parseMode, replyParameters,
|
||||
replyMarkup, linkPreviewOptions,
|
||||
messageThreadId, entities,
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace Telegrator
|
||||
public static bool IsCommand(this Message message, out string? command)
|
||||
{
|
||||
command = null;
|
||||
|
||||
if (message is not { Entities.Length: > 0, Text.Length: > 0 })
|
||||
return false;
|
||||
|
||||
@@ -69,10 +70,13 @@ namespace Telegrator
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="command"></param>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsCommand(this Message message, out string? command, out string? args)
|
||||
{
|
||||
command = null;
|
||||
args = null;
|
||||
|
||||
if (message is not { Entities.Length: > 0, Text.Length: > 0 })
|
||||
return false;
|
||||
|
||||
@@ -128,6 +132,8 @@ namespace Telegrator
|
||||
/// <returns></returns>
|
||||
public static bool TrySplitArgs(this Message message, out string[]? args)
|
||||
{
|
||||
args = null;
|
||||
|
||||
if (message is not { Text.Length: > 0 })
|
||||
return false;
|
||||
|
||||
@@ -135,10 +141,10 @@ namespace Telegrator
|
||||
return false;
|
||||
|
||||
args = null;
|
||||
if (!message.IsCommand(out _, out string> argsStr))
|
||||
if (!message.IsCommand(out _, out string? argsStr))
|
||||
return false;
|
||||
|
||||
args = argsStr.Split([' '], StringSplitOptions.RemoveEmptyEntries);
|
||||
args = argsStr?.Split([' '], StringSplitOptions.RemoveEmptyEntries);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -305,7 +311,7 @@ namespace Telegrator
|
||||
"StackExchange", "RabbitMQ", "Quartz", "Hangfire", "Npgsql", "MySql", "Oracle",
|
||||
"Bogus", "CsvHelper", "Grpc", "Swashbuckle", "MassTransit", "AngleSharp",
|
||||
"Ocelot", "BouncyCastle", "IdentityModel", "Telegrator"
|
||||
]
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Collects all public handlers from the current app domain.
|
||||
@@ -318,7 +324,7 @@ namespace Telegrator
|
||||
AppDomain.CurrentDomain
|
||||
.GetAssemblies()
|
||||
.Where(ass => skippingAssemblies.All(skip => !ass.FullName.StartsWith(skip)))
|
||||
.ForEach(ass => ass.CollectHandlersAssemblyWide());
|
||||
.ForEach(ass => handlers.CollectHandlersAssemblyWide(ass));
|
||||
|
||||
return handlers;
|
||||
}
|
||||
@@ -329,7 +335,7 @@ namespace Telegrator
|
||||
/// </summary>
|
||||
/// <returns>This collection instance for method chaining.</returns>
|
||||
/// <exception cref="Exception">Thrown when the entry assembly cannot be found.</exception>
|
||||
public static IHandlersCollection CollectHandlersAssemblyWide(this IHandlersCollection handlers, Assembly collectingTarget = null)
|
||||
public static IHandlersCollection CollectHandlersAssemblyWide(this IHandlersCollection handlers, Assembly? collectingTarget = null)
|
||||
{
|
||||
(collectingTarget ?? Assembly.GetCallingAssembly())
|
||||
.GetExportedTypes()
|
||||
|
||||
Reference in New Issue
Block a user