Skip to content

fix: don't print None for users without a last name - #340

Merged
chigwell merged 2 commits into
chigwell:mainfrom
axisrow:fix/none-in-names
Oct 20, 2026
Merged

chigwell merged 2 commits into
chigwell:mainfrom
axisrow:fix/none-in-names

Conversation

@axisrow

@axisrow axisrow commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Summary

User entities can carry last_name = None (and, for deleted accounts, no names at all), but the tools built display names with direct f-strings, producing "Ivan None" and similar artifacts in contact lists, participant lists and chat listings.

This adds a single person_name() helper in runtime.py that joins only the non-empty parts and falls back to "Deleted Account" for deleted entities, and routes all 13 name-formatting sites through it (runtime.get_sender_name, tools/chats.py × 4, tools/contacts.py × 7, tools/groups.py × 3). It also replaces the divergent variants in list_chats/get_chat, which previously included the raw None or ignored last_name depending on the call site.

Testing

  • tests/test_person_name.py covers None parts, both names present, and deleted accounts.
  • Full suite: 1411 passed.

🤖 Generated with Claude Code

Telegram omits last_name (and both names for deleted accounts), so the attributes are None and f-strings produced "Ivan None" or "None None" in list_contacts, search_contacts, get_participants, get_admins, get_banned_users, get_contact_chats, get_direct_chat_by_contact, get_last_interaction, list_chats and get_chat. Add person_name() and use it at those call sites; deleted accounts are shown as "Deleted Account".

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018Xun6C4mXUAKbVSmiEEh79
@chigwell
chigwell merged commit fce835d into chigwell:main Oct 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants