From 18370ed557bc5ce7d8bb2591ada5475db934b9e2 Mon Sep 17 00:00:00 2001 From: FajoX <146753912+FajoX1@users.noreply.github.com> Date: Fri, 22 Nov 2024 12:41:40 +0200 Subject: [PATCH] fix: help alphabet modules sort --- hikka/modules/help.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hikka/modules/help.py b/hikka/modules/help.py index 2a87672..8bf9bb3 100644 --- a/hikka/modules/help.py +++ b/hikka/modules/help.py @@ -4,6 +4,7 @@ # You can redistribute it and/or modify it under the terms of the GNU AGPLv3 # 🔑 https://www.gnu.org/licenses/agpl-3.0.html +import re import difflib import inspect import logging @@ -304,9 +305,13 @@ class Help(loader.Module): ) shown_warn = True - plain_.sort(key=lambda x: x.split()[1]) - core_.sort(key=lambda x: x.split()[1]) - no_commands_.sort(key=lambda x: x.split()[1]) + def extract_name(line): + match = re.search(r'[\U0001F300-\U0001FAFF\U0001F900-\U0001F9FF]*\s*(name.*)', line) + return match.group(1) if match else line + + plain_.sort(key=extract_name) + core_.sort(key=extract_name) + no_commands_.sort(key=extract_name) await utils.answer( message,