From 056ca03b74f98a422eda542e6cabde4c807e1a18 Mon Sep 17 00:00:00 2001 From: Qwen Date: Mon, 29 Jun 2026 18:07:20 +0300 Subject: [PATCH 1/2] =?UTF-8?q?=D0=9F=D0=BE=D1=87=D0=B8=D0=BD=D0=B8=D0=BB?= =?UTF-8?q?=20=D0=B4=D1=83=D0=B1=D0=BB=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B8=20=D0=BA?= =?UTF-8?q?=D0=B0=D1=82=D0=B5=D0=B3=D0=BE=D1=80=D0=B8=D0=B8=20=D0=B2=20/he?= =?UTF-8?q?lpList=20=D0=BF=D1=80=D0=B8=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=B4=D0=B0=D1=85=20=D0=B8=D0=B7=20=D1=80=D0=B0=D0=B7=D0=BD?= =?UTF-8?q?=D1=8B=D1=85=20=D1=81=D0=B1=D0=BE=D1=80=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HelpCommandController.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/TgBotFrame.Commands.Help/HelpCommandController.cs b/TgBotFrame.Commands.Help/HelpCommandController.cs index 2739af8..bc370d5 100644 --- a/TgBotFrame.Commands.Help/HelpCommandController.cs +++ b/TgBotFrame.Commands.Help/HelpCommandController.cs @@ -59,34 +59,34 @@ public async Task HelpList() IEnumerable buttons = commandExplorer.Commands.Values .SelectMany(x => x.Keys) .Select(x => x.DeclaringType) - .Select(x => (GetResourceManager(x?.Assembly), + .Select(x => (x?.Assembly, x?.GetCustomAttribute()?.CategoryKey)) - .Distinct() - .Select(x => + .GroupBy(x => x.CategoryKey, StringComparer.OrdinalIgnoreCase) + .Select(g => { + string? categoryKey = g.Key; string displayName; - if (string.IsNullOrEmpty(x.CategoryKey)) + if (string.IsNullOrEmpty(categoryKey)) { displayName = Resources.ResourceManager.GetString( nameof(HelpCommandController_HelpList_WithoutCategory), Context.GetCultureInfo())!; } - else if (x.Item1 is not null) - { - displayName = x.Item1.GetString(CATEGORY_NAME_PREFIX + x.CategoryKey, - Context.GetCultureInfo()) ?? x.CategoryKey; - } else { - displayName = x.CategoryKey; + displayName = g + .Select(x => GetResourceManager(x.Assembly) + ?.GetString(CATEGORY_NAME_PREFIX + categoryKey, Context.GetCultureInfo())) + .FirstOrDefault(x => x is not null) + ?? categoryKey; } - return (x.Item1, x.CategoryKey, displayName); + return (displayName, categoryKey); }).OrderBy(x => x.displayName, StringComparer.Create(Context.GetCultureInfo(), true)).Select(x => new[] { InlineKeyboardButton.WithCallbackData( x.displayName, - $@"/{nameof(HelpCategory)} {x.CategoryKey}"), + $@"/{nameof(HelpCategory)} {x.categoryKey}"), }); From f73635f0f1f1da3c53ac4fec8b616177d91b53b8 Mon Sep 17 00:00:00 2001 From: MoryakSPb <31323043+MoryakSPb@users.noreply.github.com> Date: Mon, 29 Jun 2026 18:34:17 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D0=B4=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=B4=D0=B5=D0=B1=D0=B0=D0=B3=20=D0=BA=D0=BE=D0=B4?= =?UTF-8?q?=D0=B0=20=D0=98=D0=98=20=D0=B8=20=D1=83=D0=BB=D1=83=D1=87=D1=88?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=BF=D0=BE=D1=81=D0=B8=D0=BA=20=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=BE=D0=BA=D0=B8=20=D0=BB=D0=BE=D0=BA=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D0=B8=20=D0=B4=D0=BB=D1=8F=20=D0=BA?= =?UTF-8?q?=D0=B0=D1=82=D0=B5=D0=B3=D0=BE=D1=80=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HelpCommandController.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/TgBotFrame.Commands.Help/HelpCommandController.cs b/TgBotFrame.Commands.Help/HelpCommandController.cs index bc370d5..5c9d105 100644 --- a/TgBotFrame.Commands.Help/HelpCommandController.cs +++ b/TgBotFrame.Commands.Help/HelpCommandController.cs @@ -62,11 +62,10 @@ public async Task HelpList() .Select(x => (x?.Assembly, x?.GetCustomAttribute()?.CategoryKey)) .GroupBy(x => x.CategoryKey, StringComparer.OrdinalIgnoreCase) - .Select(g => + .Select(x => { - string? categoryKey = g.Key; string displayName; - if (string.IsNullOrEmpty(categoryKey)) + if (string.IsNullOrEmpty(x.Key)) { displayName = Resources.ResourceManager.GetString( nameof(HelpCommandController_HelpList_WithoutCategory), @@ -74,19 +73,18 @@ public async Task HelpList() } else { - displayName = g - .Select(x => GetResourceManager(x.Assembly) - ?.GetString(CATEGORY_NAME_PREFIX + categoryKey, Context.GetCultureInfo())) - .FirstOrDefault(x => x is not null) - ?? categoryKey; + displayName = x.Select(y => GetResourceManager(y.Assembly) + ?.GetString(CATEGORY_NAME_PREFIX + x.Key, Context.GetCultureInfo())) + .FirstOrDefault(y => !string.IsNullOrEmpty(y)) + ?? x.Key; } - return (displayName, categoryKey); + return (displayName, x.Key); }).OrderBy(x => x.displayName, StringComparer.Create(Context.GetCultureInfo(), true)).Select(x => new[] { InlineKeyboardButton.WithCallbackData( x.displayName, - $@"/{nameof(HelpCategory)} {x.categoryKey}"), + $@"/{nameof(HelpCategory)} {x.Key}"), });