Repository navigation
fix: don't print None for users without a last name - #340
Merged
Merged
Conversation
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
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018Xun6C4mXUAKbVSmiEEh79
chigwell
approved these changes
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 inruntime.pythat 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 inlist_chats/get_chat, which previously included the rawNoneor ignoredlast_namedepending on the call site.Testing
tests/test_person_name.pycovers None parts, both names present, and deleted accounts.🤖 Generated with Claude Code