From a18eab0f311c1f948c2ee79fd69e872f4944f05c Mon Sep 17 00:00:00 2001 From: Rikitav Date: Fri, 6 Mar 2026 21:05:57 +0400 Subject: [PATCH] * Fixed minor building errors --- .../Polling/HostUpdateHandlersPool.cs | 6 ++++-- Telegrator.Tests/Telegrator.Tests.csproj | 2 +- Telegrator/Handlers/CallbackQueryHandler.cs | 2 +- Telegrator/TypesExtensions.cs | 16 +++++++++++----- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Telegrator.Hosting/Polling/HostUpdateHandlersPool.cs b/Telegrator.Hosting/Polling/HostUpdateHandlersPool.cs index ad21b7a..97211f2 100644 --- a/Telegrator.Hosting/Polling/HostUpdateHandlersPool.cs +++ b/Telegrator.Hosting/Polling/HostUpdateHandlersPool.cs @@ -1,12 +1,14 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +using Telegrator.MadiatorCore; using Telegrator.Polling; namespace Telegrator.Hosting.Polling { /// - public class HostUpdateHandlersPool(IOptions options, ILogger logger) : UpdateHandlersPool(options.Value, options.Value.GlobalCancellationToken) + public class HostUpdateHandlersPool(IUpdateRouter router, IOptions options) + : UpdateHandlersPool(router, options.Value, options.Value.GlobalCancellationToken) { - private readonly ILogger _logger = logger; + } } diff --git a/Telegrator.Tests/Telegrator.Tests.csproj b/Telegrator.Tests/Telegrator.Tests.csproj index ee19e6b..244fd58 100644 --- a/Telegrator.Tests/Telegrator.Tests.csproj +++ b/Telegrator.Tests/Telegrator.Tests.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net10.0 enable enable false diff --git a/Telegrator/Handlers/CallbackQueryHandler.cs b/Telegrator/Handlers/CallbackQueryHandler.cs index d0134e2..22f2310 100644 --- a/Telegrator/Handlers/CallbackQueryHandler.cs +++ b/Telegrator/Handlers/CallbackQueryHandler.cs @@ -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, diff --git a/Telegrator/TypesExtensions.cs b/Telegrator/TypesExtensions.cs index d32c93f..5c40cd9 100644 --- a/Telegrator/TypesExtensions.cs +++ b/Telegrator/TypesExtensions.cs @@ -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 /// /// /// + /// /// 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 /// 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" - ] + ]; /// /// 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 /// /// This collection instance for method chaining. /// Thrown when the entry assembly cannot be found. - public static IHandlersCollection CollectHandlersAssemblyWide(this IHandlersCollection handlers, Assembly collectingTarget = null) + public static IHandlersCollection CollectHandlersAssemblyWide(this IHandlersCollection handlers, Assembly? collectingTarget = null) { (collectingTarget ?? Assembly.GetCallingAssembly()) .GetExportedTypes()