Skip to content

fix(groups): handle basic groups in get_admins, get_banned_users and the admin/ban tools - #346

Merged
chigwell merged 1 commit into
chigwell:mainfrom
axisrow:fix/basic-group-admins
Oct 21, 2026
Merged

chigwell merged 1 commit into
chigwell:mainfrom
axisrow:fix/basic-group-admins

Conversation

@axisrow

@axisrow axisrow commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

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_admins listed all participants as admins — and promote_admin/demote_admin/ban_user/unban_user sent channel-only mutation requests that failed opaquely.

Per-tool behavior on a basic group now:

  • get_admins reads creator + admins from the full-chat participant list (_basic_group_admins).
  • get_banned_users explains that a basic group has no ban list.
  • promote_admin / demote_admin use messages.EditChatAdminRequest (the basic-group single-admin-level API) and note that per-right settings do not exist there.
  • ban_user / unban_user return a readable pointer to remove_user or supergroup conversion (BASIC_GROUP_NO_BANS).

Testing

  • tests/test_basic_group_admins.py covers each of the five tools against a types.Chat entity.
  • Full suite: 1413 passed.

🤖 Generated with Claude Code

…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
chigwell merged commit b6b31a0 into chigwell:main Oct 21, 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