From 3566bd816da5dff7fa5a7baefaf497a3171ebcf4 Mon Sep 17 00:00:00 2001 From: MoryakSPb <31323043+MoryakSPb@users.noreply.github.com> Date: Wed, 27 Aug 2025 21:11:09 +0300 Subject: [PATCH 1/5] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BD=D1=8B=20?= =?UTF-8?q?=D0=BB=D0=B8=D1=88=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=D1=81=D1=8B=20=D1=81=D1=82=D1=80=D0=BE=D0=BA=20?= =?UTF-8?q?=D0=B2=20/helpSyntax?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Properties/Resources.Designer.cs | 13 ++++--------- .../Properties/Resources.en.resx | 8 ++------ TgBotFrame.Commands.Help/Properties/Resources.resx | 11 +++-------- 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/TgBotFrame.Commands.Help/Properties/Resources.Designer.cs b/TgBotFrame.Commands.Help/Properties/Resources.Designer.cs index 303d60c..4e43d17 100644 --- a/TgBotFrame.Commands.Help/Properties/Resources.Designer.cs +++ b/TgBotFrame.Commands.Help/Properties/Resources.Designer.cs @@ -340,16 +340,11 @@ public static string HelpCommandController_HelpList_WithoutCategory { } /// - /// Ищет локализованную строку, похожую на Команды бота принимают два типа значений: команды и параметры\. - ///Команда является идентификатором конкретного действия, которое должен - ///совершить бот\. Идентификаторы команд не зависят от регистра: возможно - ///использовать как строчные, так и заглавные буквы\. - ///Параметрами являются данные необходимые для совершения действия\. + /// Ищет локализованную строку, похожую на Команды бота принимают два типа значений: команды и параметры\. Команда является идентификатором конкретного действия, которое должен + ///совершить бот\. Идентификаторы команд не зависят от регистра: возможно использовать как строчные, так и заглавные буквы\. Параметрами являются данные необходимые для совершения действия\. /// - ///Любая команда начинается с символа `/`; сразу после символа идет идентификатор - ///команды\. - ///Параметры разделяются между собой и идентификатором команды пробелами\. - ///Например: на сообще [остаток строки не уместился]";. + ///Любая команда начинается с символа `/`; сразу после символа идет идентификатор команды\. Параметры разделяются между собой и идентификатором команды пробелами\. + ///Например: на сообщение ` [остаток строки не уместился]";. /// public static string HelpCommandController_HelpSyntax_Title { get { diff --git a/TgBotFrame.Commands.Help/Properties/Resources.en.resx b/TgBotFrame.Commands.Help/Properties/Resources.en.resx index f7962d0..fde7404 100644 --- a/TgBotFrame.Commands.Help/Properties/Resources.en.resx +++ b/TgBotFrame.Commands.Help/Properties/Resources.en.resx @@ -238,14 +238,10 @@ This category contains help commands. Most of these commands can be used without entering them manually, using the menu buttons from the help command - Bot commands accept two types of values: commands and arguments\. -A command is an identifier of a specific action that the bot should perform\. Command identifiers are case\-insensitive: you can use both lowercase and uppercase letters\. + Bot commands accept two types of values: commands and arguments\. A command is an identifier of a specific action that the bot should perform\. Command identifiers are case\-insensitive: you can use both lowercase and uppercase letters\. Parameters are the data required to perform an action\. -Any command begins with the `/` symbol; immediately after the symbol comes the -command identifier\. -Parameters are separated from each other and the command identifier by spaces\. -For example: the bot will respond to the message `/HelpCommand Help` with help on the `Help` command\. +Any command begins with the `/` symbol; immediately after the symbol comes the command identifier\. Parameters are separated from each other and the command identifier by spaces\. For example: the bot will respond to the message `/HelpCommand Help` with help on the `Help` command\. Argument formats: diff --git a/TgBotFrame.Commands.Help/Properties/Resources.resx b/TgBotFrame.Commands.Help/Properties/Resources.resx index 21f0489..87258d4 100644 --- a/TgBotFrame.Commands.Help/Properties/Resources.resx +++ b/TgBotFrame.Commands.Help/Properties/Resources.resx @@ -179,15 +179,10 @@ (без категории) - Команды бота принимают два типа значений: команды и параметры\. -Команда является идентификатором конкретного действия, которое должен -совершить бот\. Идентификаторы команд не зависят от регистра: возможно -использовать как строчные, так и заглавные буквы\. -Параметрами являются данные необходимые для совершения действия\. + Команды бота принимают два типа значений: команды и параметры\. Команда является идентификатором конкретного действия, которое должен +совершить бот\. Идентификаторы команд не зависят от регистра: возможно использовать как строчные, так и заглавные буквы\. Параметрами являются данные необходимые для совершения действия\. -Любая команда начинается с символа `/`; сразу после символа идет идентификатор -команды\. -Параметры разделяются между собой и идентификатором команды пробелами\. +Любая команда начинается с символа `/`; сразу после символа идет идентификатор команды\. Параметры разделяются между собой и идентификатором команды пробелами\. Например: на сообщение `/HelpCommand Help` бот ответит справкой по команде `Help`\. Форматы аргументов: From aa70c04b59e3a3c74d600cf2a868ef8513677505 Mon Sep 17 00:00:00 2001 From: MoryakSPb <31323043+MoryakSPb@users.noreply.github.com> Date: Wed, 27 Aug 2025 21:13:56 +0300 Subject: [PATCH 2/5] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=BD=D0=BE=D0=BC=D0=B5=D1=80=20=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D1=81=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TgBotFrame.Commands.Authorization.csproj | 2 +- TgBotFrame.Commands.Help/TgBotFrame.Commands.Help.csproj | 2 +- .../TgBotFrame.Commands.RateLimit.csproj | 2 +- TgBotFrame.Commands.Start/TgBotFrame.Commands.Start.csproj | 2 +- TgBotFrame.Commands/TgBotFrame.Commands.csproj | 2 +- TgBotFrame/TgBotFrame.csproj | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/TgBotFrame.Commands.Authorization/TgBotFrame.Commands.Authorization.csproj b/TgBotFrame.Commands.Authorization/TgBotFrame.Commands.Authorization.csproj index a90b0a1..2a2cf26 100644 --- a/TgBotFrame.Commands.Authorization/TgBotFrame.Commands.Authorization.csproj +++ b/TgBotFrame.Commands.Authorization/TgBotFrame.Commands.Authorization.csproj @@ -16,7 +16,7 @@ True MIT README.md - 1.3.15 + 2.0.0 True snupkg telegram,tg,commands diff --git a/TgBotFrame.Commands.Help/TgBotFrame.Commands.Help.csproj b/TgBotFrame.Commands.Help/TgBotFrame.Commands.Help.csproj index b59771f..bb05f74 100644 --- a/TgBotFrame.Commands.Help/TgBotFrame.Commands.Help.csproj +++ b/TgBotFrame.Commands.Help/TgBotFrame.Commands.Help.csproj @@ -16,7 +16,7 @@ True MIT README.md - 1.4.17 + 2.0.0 True snupkg telegram,tg,commands diff --git a/TgBotFrame.Commands.RateLimit/TgBotFrame.Commands.RateLimit.csproj b/TgBotFrame.Commands.RateLimit/TgBotFrame.Commands.RateLimit.csproj index 292764d..af102ec 100644 --- a/TgBotFrame.Commands.RateLimit/TgBotFrame.Commands.RateLimit.csproj +++ b/TgBotFrame.Commands.RateLimit/TgBotFrame.Commands.RateLimit.csproj @@ -16,7 +16,7 @@ True MIT README.md - 1.2.10 + 2.0.0 True snupkg telegram,tg,commands diff --git a/TgBotFrame.Commands.Start/TgBotFrame.Commands.Start.csproj b/TgBotFrame.Commands.Start/TgBotFrame.Commands.Start.csproj index a740b5e..a8dea92 100644 --- a/TgBotFrame.Commands.Start/TgBotFrame.Commands.Start.csproj +++ b/TgBotFrame.Commands.Start/TgBotFrame.Commands.Start.csproj @@ -16,7 +16,7 @@ True MIT README.md - 1.2.11 + 2.0.0 True snupkg telegram,tg,commands diff --git a/TgBotFrame.Commands/TgBotFrame.Commands.csproj b/TgBotFrame.Commands/TgBotFrame.Commands.csproj index 9fc3184..e24c247 100644 --- a/TgBotFrame.Commands/TgBotFrame.Commands.csproj +++ b/TgBotFrame.Commands/TgBotFrame.Commands.csproj @@ -16,7 +16,7 @@ True MIT README.md - 1.3.11 + 2.0.0 True snupkg telegram,tg,commands diff --git a/TgBotFrame/TgBotFrame.csproj b/TgBotFrame/TgBotFrame.csproj index 6d97268..4c29f15 100644 --- a/TgBotFrame/TgBotFrame.csproj +++ b/TgBotFrame/TgBotFrame.csproj @@ -16,7 +16,7 @@ True MIT README.md - 1.2.10 + 2.0.0 True snupkg telegram,tg,commands,bot From a68fc35642ddf097fa2b920549cf272c9a3e316a Mon Sep 17 00:00:00 2001 From: MoryakSPb <31323043+MoryakSPb@users.noreply.github.com> Date: Wed, 27 Aug 2025 21:31:03 +0300 Subject: [PATCH 3/5] =?UTF-8?q?=D0=98=D1=81=D0=BA=D0=BB=D1=8E=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BE=D1=81=D1=82=D0=B0=D0=B2=D1=88=D0=B8=D0=B5?= =?UTF-8?q?=D1=81=D1=8F=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BD=D0=BE=D1=81=D1=8B?= =?UTF-8?q?=20=D0=B2=20/helpSyntax?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TgBotFrame.Commands.Help/Properties/Resources.Designer.cs | 6 ++---- TgBotFrame.Commands.Help/Properties/Resources.en.resx | 3 +-- TgBotFrame.Commands.Help/Properties/Resources.resx | 6 ++---- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/TgBotFrame.Commands.Help/Properties/Resources.Designer.cs b/TgBotFrame.Commands.Help/Properties/Resources.Designer.cs index 4e43d17..64ad13d 100644 --- a/TgBotFrame.Commands.Help/Properties/Resources.Designer.cs +++ b/TgBotFrame.Commands.Help/Properties/Resources.Designer.cs @@ -340,11 +340,9 @@ public static string HelpCommandController_HelpList_WithoutCategory { } /// - /// Ищет локализованную строку, похожую на Команды бота принимают два типа значений: команды и параметры\. Команда является идентификатором конкретного действия, которое должен - ///совершить бот\. Идентификаторы команд не зависят от регистра: возможно использовать как строчные, так и заглавные буквы\. Параметрами являются данные необходимые для совершения действия\. + /// Ищет локализованную строку, похожую на Команды бота принимают два типа значений: команды и параметры\. Команда является идентификатором конкретного действия, которое должен совершить бот\. Идентификаторы команд не зависят от регистра: возможно использовать как строчные, так и заглавные буквы\. Параметрами являются данные необходимые для совершения действия\. /// - ///Любая команда начинается с символа `/`; сразу после символа идет идентификатор команды\. Параметры разделяются между собой и идентификатором команды пробелами\. - ///Например: на сообщение ` [остаток строки не уместился]";. + ///Любая команда начинается с символа `/`; сразу после символа идет идентификатор команды\. Параметры разделяются между собой и идентификатором команды пробелами\. Например: на сообщение `/H [остаток строки не уместился]";. /// public static string HelpCommandController_HelpSyntax_Title { get { diff --git a/TgBotFrame.Commands.Help/Properties/Resources.en.resx b/TgBotFrame.Commands.Help/Properties/Resources.en.resx index fde7404..1c31d7d 100644 --- a/TgBotFrame.Commands.Help/Properties/Resources.en.resx +++ b/TgBotFrame.Commands.Help/Properties/Resources.en.resx @@ -238,8 +238,7 @@ This category contains help commands. Most of these commands can be used without entering them manually, using the menu buttons from the help command - Bot commands accept two types of values: commands and arguments\. A command is an identifier of a specific action that the bot should perform\. Command identifiers are case\-insensitive: you can use both lowercase and uppercase letters\. -Parameters are the data required to perform an action\. + Bot commands accept two types of values: commands and arguments\. A command is an identifier of a specific action that the bot should perform\. Command identifiers are case\-insensitive: you can use both lowercase and uppercase letters\. Parameters are the data required to perform an action\. Any command begins with the `/` symbol; immediately after the symbol comes the command identifier\. Parameters are separated from each other and the command identifier by spaces\. For example: the bot will respond to the message `/HelpCommand Help` with help on the `Help` command\. diff --git a/TgBotFrame.Commands.Help/Properties/Resources.resx b/TgBotFrame.Commands.Help/Properties/Resources.resx index 87258d4..6f009e1 100644 --- a/TgBotFrame.Commands.Help/Properties/Resources.resx +++ b/TgBotFrame.Commands.Help/Properties/Resources.resx @@ -179,11 +179,9 @@ (без категории) - Команды бота принимают два типа значений: команды и параметры\. Команда является идентификатором конкретного действия, которое должен -совершить бот\. Идентификаторы команд не зависят от регистра: возможно использовать как строчные, так и заглавные буквы\. Параметрами являются данные необходимые для совершения действия\. + Команды бота принимают два типа значений: команды и параметры\. Команда является идентификатором конкретного действия, которое должен совершить бот\. Идентификаторы команд не зависят от регистра: возможно использовать как строчные, так и заглавные буквы\. Параметрами являются данные необходимые для совершения действия\. -Любая команда начинается с символа `/`; сразу после символа идет идентификатор команды\. Параметры разделяются между собой и идентификатором команды пробелами\. -Например: на сообщение `/HelpCommand Help` бот ответит справкой по команде `Help`\. +Любая команда начинается с символа `/`; сразу после символа идет идентификатор команды\. Параметры разделяются между собой и идентификатором команды пробелами\. Например: на сообщение `/HelpCommand Help` бот ответит справкой по команде `Help`\. Форматы аргументов: From 5a2817120f4dbfc0bd0624bf400a3e0281afae21 Mon Sep 17 00:00:00 2001 From: MoryakSPb <31323043+MoryakSPb@users.noreply.github.com> Date: Wed, 27 Aug 2025 23:07:57 +0300 Subject: [PATCH 4/5] =?UTF-8?q?=D0=A4=D0=BE=D1=80=D0=BC=D0=B0=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=B4?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Directory.Packages.props | 30 +++++++++---------- .../TgBotFrame.Commands.RateLimit.csproj | 6 ++-- .../Middleware/CommandRouterMiddleware.cs | 6 ++-- TgBotFrame.Tests/PipelineTests.cs | 9 ++---- 4 files changed, 24 insertions(+), 27 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 27cf1e7..2019dab 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,17 +1,17 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TgBotFrame.Commands.RateLimit/TgBotFrame.Commands.RateLimit.csproj b/TgBotFrame.Commands.RateLimit/TgBotFrame.Commands.RateLimit.csproj index af102ec..7ff2e2e 100644 --- a/TgBotFrame.Commands.RateLimit/TgBotFrame.Commands.RateLimit.csproj +++ b/TgBotFrame.Commands.RateLimit/TgBotFrame.Commands.RateLimit.csproj @@ -31,14 +31,14 @@ - all - runtime; build; native; contentfiles; analyzers; buildtransitive + all + runtime; build; native; contentfiles; analyzers; buildtransitive - + \ No newline at end of file diff --git a/TgBotFrame.Commands/Middleware/CommandRouterMiddleware.cs b/TgBotFrame.Commands/Middleware/CommandRouterMiddleware.cs index f3aecb4..84e62c7 100644 --- a/TgBotFrame.Commands/Middleware/CommandRouterMiddleware.cs +++ b/TgBotFrame.Commands/Middleware/CommandRouterMiddleware.cs @@ -114,9 +114,9 @@ await botClient.SendMessage(update.Message!.Chat, + Environment.NewLine + string.Format(Resources.ResourceManager.GetString(@"UseHelpMessage", Culture)!, ExceptedName), replyParameters: new() - { - MessageId = update.Message.MessageId, - }, + { + MessageId = update.Message.MessageId, + }, cancellationToken: ct).ConfigureAwait(false); } diff --git a/TgBotFrame.Tests/PipelineTests.cs b/TgBotFrame.Tests/PipelineTests.cs index d08571a..96c980d 100644 --- a/TgBotFrame.Tests/PipelineTests.cs +++ b/TgBotFrame.Tests/PipelineTests.cs @@ -33,8 +33,7 @@ public async Task IncPipeline() { IServiceCollection services = new ServiceCollection(); services.AddSingleton(); - services.AddSingleton( - x => x.GetRequiredService()); + services.AddSingleton(x => x.GetRequiredService()); services.AddSingleton(); services.AddLogging(builder => builder.AddConsole()); services.AddMetrics(); @@ -55,11 +54,9 @@ public async Task IncDecPipeline() { IServiceCollection services = new ServiceCollection(); services.AddSingleton(); - services.AddSingleton( - x => x.GetRequiredService()); + services.AddSingleton(x => x.GetRequiredService()); services.AddSingleton(); - services.AddSingleton( - x => x.GetRequiredService()); + services.AddSingleton(x => x.GetRequiredService()); services.AddSingleton(); services.AddLogging(builder => builder.AddConsole()); services.AddMetrics(); From 35fe0d5137f685e77523ae1d377587e3491ee8d5 Mon Sep 17 00:00:00 2001 From: MoryakSPb <31323043+MoryakSPb@users.noreply.github.com> Date: Wed, 27 Aug 2025 23:13:35 +0300 Subject: [PATCH 5/5] =?UTF-8?q?=D0=A4=D0=BE=D1=80=D0=BC=D0=B0=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=B4?= =?UTF-8?q?=D0=B0=20(2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Middleware/CommandRouterMiddleware.cs | 6 +-- .../Stubs/StubTelegramBotClient.cs | 52 +++++++++---------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/TgBotFrame.Commands/Middleware/CommandRouterMiddleware.cs b/TgBotFrame.Commands/Middleware/CommandRouterMiddleware.cs index 84e62c7..f3aecb4 100644 --- a/TgBotFrame.Commands/Middleware/CommandRouterMiddleware.cs +++ b/TgBotFrame.Commands/Middleware/CommandRouterMiddleware.cs @@ -114,9 +114,9 @@ await botClient.SendMessage(update.Message!.Chat, + Environment.NewLine + string.Format(Resources.ResourceManager.GetString(@"UseHelpMessage", Culture)!, ExceptedName), replyParameters: new() - { - MessageId = update.Message.MessageId, - }, + { + MessageId = update.Message.MessageId, + }, cancellationToken: ct).ConfigureAwait(false); } diff --git a/TgBotFrame.Tests/Stubs/StubTelegramBotClient.cs b/TgBotFrame.Tests/Stubs/StubTelegramBotClient.cs index 88256c9..1269041 100644 --- a/TgBotFrame.Tests/Stubs/StubTelegramBotClient.cs +++ b/TgBotFrame.Tests/Stubs/StubTelegramBotClient.cs @@ -19,36 +19,36 @@ public Task SendRequest(IRequest request, switch (request) { case GetMeRequest: - { - User user = new() { - Id = 0, - Username = "TEST", - LanguageCode = "en", - FirstName = "TEST_NAME", - IsBot = true, - }; - string json = JsonSerializer.Serialize(user); - return Task.FromResult(JsonSerializer.Deserialize(json)!); - } + User user = new() + { + Id = 0, + Username = "TEST", + LanguageCode = "en", + FirstName = "TEST_NAME", + IsBot = true, + }; + string json = JsonSerializer.Serialize(user); + return Task.FromResult(JsonSerializer.Deserialize(json)!); + } case SendMessageRequest sendMessageRequest: - { - Message message = new() { - Id = Random.Shared.Next(0), - Chat = new() + Message message = new() { - Id = sendMessageRequest.ChatId.Identifier.GetValueOrDefault(0L), - Username = sendMessageRequest.ChatId.Username, - Type = ChatType.Private, - }, - Text = sendMessageRequest.Text, - MessageThreadId = sendMessageRequest.MessageThreadId, - }; - Messages.Enqueue(sendMessageRequest); - string json = JsonSerializer.Serialize(message); - return Task.FromResult(JsonSerializer.Deserialize(json)!); - } + Id = Random.Shared.Next(0), + Chat = new() + { + Id = sendMessageRequest.ChatId.Identifier.GetValueOrDefault(0L), + Username = sendMessageRequest.ChatId.Username, + Type = ChatType.Private, + }, + Text = sendMessageRequest.Text, + MessageThreadId = sendMessageRequest.MessageThreadId, + }; + Messages.Enqueue(sendMessageRequest); + string json = JsonSerializer.Serialize(message); + return Task.FromResult(JsonSerializer.Deserialize(json)!); + } default: throw new NotImplementedException(); }