Skip to content

Commit 79a73be

Browse files
committed
fix: support manage_topics admin right in promote/demote/edit_admin_rights
promote_admin builds ChatAdminRights from a fixed dict that silently dropped manage_topics — granting topic rights via MCP was impossible (bots promoted this way could not create forum topics). Extracted from #126.
1 parent 17b5e05 commit 79a73be

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

telegram_mcp/tools/groups.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ async def promote_admin(
487487
"add_admins": False,
488488
"anonymous": False,
489489
"manage_call": True,
490+
"manage_topics": True,
490491
"other": True,
491492
}
492493

@@ -501,6 +502,7 @@ async def promote_admin(
501502
add_admins=rights.get("add_admins", False),
502503
anonymous=rights.get("anonymous", False),
503504
manage_call=rights.get("manage_call", True),
505+
manage_topics=rights.get("manage_topics", True),
504506
other=rights.get("other", True),
505507
)
506508

@@ -560,6 +562,7 @@ async def demote_admin(
560562
add_admins=False,
561563
anonymous=False,
562564
manage_call=False,
565+
manage_topics=False,
563566
other=False,
564567
)
565568

@@ -839,6 +842,7 @@ async def edit_admin_rights(
839842
add_admins: bool = False,
840843
anonymous: bool = False,
841844
manage_call: bool = False,
845+
manage_topics: bool = False,
842846
other: bool = False,
843847
account: str = None,
844848
) -> str:
@@ -863,6 +867,7 @@ async def edit_admin_rights(
863867
add_admins: can add new admins with their own rights
864868
anonymous: admin actions appear anonymous
865869
manage_call: can manage voice/video chats
870+
manage_topics: can create, edit, close and reopen forum topics (forum-enabled supergroups only)
866871
other: reserved for future rights
867872
"""
868873
try:
@@ -881,6 +886,7 @@ async def edit_admin_rights(
881886
add_admins=add_admins,
882887
anonymous=anonymous,
883888
manage_call=manage_call,
889+
manage_topics=manage_topics,
884890
other=other,
885891
)
886892
await cl(

0 commit comments

Comments
 (0)