From 82a1687bdeba8ea093705e564ad8e08100ac9f3a Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 2 Jan 2026 22:18:41 +0000 Subject: [PATCH] Expand nickname generation for better name variations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enhanced _generate_nicknames() to support more name variations: Before (for 8-char name "Kenearos"): - Generated: Kene (4 chars only) After: - Generates at 4, 6, 8, 10, 12 character positions - For "kenearosmd": Kene, Kenear, Kenearos, kenearosmd - Special handling: removes 'md' suffix if present (kenearosmd → also adds kenearos) This allows users with longer usernames to be recognized: - Bot name "kenearosmd" generates: kene, kenear, kenearos - Bot responds to all variations and the full name Fixes issue where users couldn't use their full username if it was longer than the configured bot name. --- utils.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/utils.py b/utils.py index 826a549..674a170 100644 --- a/utils.py +++ b/utils.py @@ -49,11 +49,16 @@ class MentionDetector: """Generate common nicknames from bot name""" nicknames = [] - # For kenearosmd, generate: Kene, Kenearos - if len(bot_name) >= 4: - nicknames.append(bot_name[:4]) # First 4 chars (Kene) - if len(bot_name) >= 8: - nicknames.append(bot_name[:8]) # First 8 chars (Kenearos) + # Generate nicknames at 4, 6, 8, 10 character positions + # For kenearosmd: Kene, Kenear, Kenearos, kenearosmd + for length in [4, 6, 8, 10, 12]: + if len(bot_name) >= length: + nicknames.append(bot_name[:length]) + + # Also add common variations + # If name ends with 'md', add version without it + if bot_name.lower().endswith('md') and len(bot_name) > 2: + nicknames.append(bot_name[:-2]) # kenearos from kenearosmd # Remove duplicates and the full name nicknames = [n for n in set(nicknames) if n != bot_name]