* Fixed minor building errors

This commit is contained in:
2026-03-06 21:05:57 +04:00
parent 516367c602
commit a18eab0f31
4 changed files with 17 additions and 9 deletions
@@ -1,12 +1,14 @@
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Telegrator.MadiatorCore;
using Telegrator.Polling; using Telegrator.Polling;
namespace Telegrator.Hosting.Polling namespace Telegrator.Hosting.Polling
{ {
/// <inheritdoc/> /// <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;
} }
} }
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
+1 -1
View File
@@ -77,7 +77,7 @@ namespace Telegrator.Handlers
int? directMessageTopicId = null, int? directMessageTopicId = null,
SuggestedPostParameters? suggestedPostParameters = null, SuggestedPostParameters? suggestedPostParameters = null,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
=> await Container.Response( => await Container.Responce(
text, parseMode, replyParameters, text, parseMode, replyParameters,
replyMarkup, linkPreviewOptions, replyMarkup, linkPreviewOptions,
messageThreadId, entities, messageThreadId, entities,
+11 -5
View File
@@ -44,6 +44,7 @@ namespace Telegrator
public static bool IsCommand(this Message message, out string? command) public static bool IsCommand(this Message message, out string? command)
{ {
command = null; command = null;
if (message is not { Entities.Length: > 0, Text.Length: > 0 }) if (message is not { Entities.Length: > 0, Text.Length: > 0 })
return false; return false;
@@ -69,10 +70,13 @@ namespace Telegrator
/// </summary> /// </summary>
/// <param name="message"></param> /// <param name="message"></param>
/// <param name="command"></param> /// <param name="command"></param>
/// <param name="args"></param>
/// <returns></returns> /// <returns></returns>
public static bool IsCommand(this Message message, out string? command, out string? args) public static bool IsCommand(this Message message, out string? command, out string? args)
{ {
command = null; command = null;
args = null;
if (message is not { Entities.Length: > 0, Text.Length: > 0 }) if (message is not { Entities.Length: > 0, Text.Length: > 0 })
return false; return false;
@@ -128,6 +132,8 @@ namespace Telegrator
/// <returns></returns> /// <returns></returns>
public static bool TrySplitArgs(this Message message, out string[]? args) public static bool TrySplitArgs(this Message message, out string[]? args)
{ {
args = null;
if (message is not { Text.Length: > 0 }) if (message is not { Text.Length: > 0 })
return false; return false;
@@ -135,10 +141,10 @@ namespace Telegrator
return false; return false;
args = null; args = null;
if (!message.IsCommand(out _, out string> argsStr)) if (!message.IsCommand(out _, out string? argsStr))
return false; return false;
args = argsStr.Split([' '], StringSplitOptions.RemoveEmptyEntries); args = argsStr?.Split([' '], StringSplitOptions.RemoveEmptyEntries);
return true; return true;
} }
} }
@@ -305,7 +311,7 @@ namespace Telegrator
"StackExchange", "RabbitMQ", "Quartz", "Hangfire", "Npgsql", "MySql", "Oracle", "StackExchange", "RabbitMQ", "Quartz", "Hangfire", "Npgsql", "MySql", "Oracle",
"Bogus", "CsvHelper", "Grpc", "Swashbuckle", "MassTransit", "AngleSharp", "Bogus", "CsvHelper", "Grpc", "Swashbuckle", "MassTransit", "AngleSharp",
"Ocelot", "BouncyCastle", "IdentityModel", "Telegrator" "Ocelot", "BouncyCastle", "IdentityModel", "Telegrator"
] ];
/// <summary> /// <summary>
/// Collects all public handlers from the current app domain. /// Collects all public handlers from the current app domain.
@@ -318,7 +324,7 @@ namespace Telegrator
AppDomain.CurrentDomain AppDomain.CurrentDomain
.GetAssemblies() .GetAssemblies()
.Where(ass => skippingAssemblies.All(skip => !ass.FullName.StartsWith(skip))) .Where(ass => skippingAssemblies.All(skip => !ass.FullName.StartsWith(skip)))
.ForEach(ass => ass.CollectHandlersAssemblyWide()); .ForEach(ass => handlers.CollectHandlersAssemblyWide(ass));
return handlers; return handlers;
} }
@@ -329,7 +335,7 @@ namespace Telegrator
/// </summary> /// </summary>
/// <returns>This collection instance for method chaining.</returns> /// <returns>This collection instance for method chaining.</returns>
/// <exception cref="Exception">Thrown when the entry assembly cannot be found.</exception> /// <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()) (collectingTarget ?? Assembly.GetCallingAssembly())
.GetExportedTypes() .GetExportedTypes()