Repository navigation
fix(groups): handle basic groups in get_admins, get_banned_users and the admin/ban tools - #346
Merged
Merged
Conversation
…the admin/ban tools Telegram's participant filters exist only for supergroups and channels. For a basic group Telethon ignores the filter, so get_admins and get_banned_users returned every member (a 5-person group with no bans showed 5 banned users and 5 admins), and ban_user/unban_user/promote_admin/demote_admin called channels.* requests and failed with an opaque error. Read creator and admins from messages.getFullChat, answer that a basic group has no ban list, and promote/demote through messages.editChatAdmin. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018Xun6C4mXUAKbVSmiEEh79
chigwell
approved these changes
Oct 21, 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
The admin/ban tools silently mishandled basic groups (
types.Chat): participant filters (ChannelParticipantsAdmins,ChannelParticipantsKicked) exist only for supergroups and channels, so Telethon ignored them and returned every member —get_adminslisted all participants as admins — andpromote_admin/demote_admin/ban_user/unban_usersent channel-only mutation requests that failed opaquely.Per-tool behavior on a basic group now:
get_adminsreads creator + admins from the full-chat participant list (_basic_group_admins).get_banned_usersexplains that a basic group has no ban list.promote_admin/demote_adminusemessages.EditChatAdminRequest(the basic-group single-admin-level API) and note that per-right settings do not exist there.ban_user/unban_userreturn a readable pointer toremove_useror supergroup conversion (BASIC_GROUP_NO_BANS).Testing
tests/test_basic_group_admins.pycovers each of the five tools against atypes.Chatentity.🤖 Generated with Claude Code