- Notifications
You must be signed in to change notification settings - Fork5.7k
Addcan_manage_topics
forpromoteChatMember
andChat*
classes#3342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
8559397
6c03fb7
46c10c5
f7a3b3a
c780084
39bcaf1
e6a876e
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -5332,6 +5332,7 @@ async def promote_chat_member( | ||
is_anonymous: bool = None, | ||
can_manage_chat: bool = None, | ||
can_manage_video_chats: bool = None, | ||
can_manage_topics: bool = None, | ||
*, | ||
read_timeout: ODVInput[float] = DEFAULT_NONE, | ||
write_timeout: ODVInput[float] = DEFAULT_NONE, | ||
@@ -5386,6 +5387,10 @@ async def promote_chat_member( | ||
add new administrators with a subset of his own privileges or demote administrators | ||
that he has promoted, directly or indirectly (promoted by administrators that were | ||
appointed by him). | ||
can_manage_topics (:obj: `bool`, optional): Pass :obj:`True`, if the administrator is | ||
allowed to create, rename, close, and reopen forum topics, supergroups only. | ||
Bibo-Joshi marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
.. versionadded:: 20.0 | ||
Keyword Args: | ||
read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to | ||
@@ -5434,6 +5439,8 @@ async def promote_chat_member( | ||
data["can_manage_chat"] = can_manage_chat | ||
if can_manage_video_chats is not None: | ||
data["can_manage_video_chats"] = can_manage_video_chats | ||
if can_manage_topics is not None: | ||
data["can_manage_topics"] = can_manage_topics | ||
result = await self._post( | ||
"promoteChatMember", | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -29,7 +29,12 @@ class ChatAdministratorRights(TelegramObject): | ||
considered equal, if their :attr:`is_anonymous`, :attr:`can_manage_chat`, | ||
:attr:`can_delete_messages`, :attr:`can_manage_video_chats`, :attr:`can_restrict_members`, | ||
:attr:`can_promote_members`, :attr:`can_change_info`, :attr:`can_invite_users`, | ||
:attr:`can_post_messages`, :attr:`can_edit_messages`, :attr:`can_pin_messages`, | ||
:attr:`can_manage_topics` are equal. | ||
harshil21 marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
.. versionchanged:: 20.0 | ||
harshil21 marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
:attr:`can_manage_topics` is considered as well when comparing objects of | ||
this type in terms of equality. | ||
.. seealso: :meth:`Bot.set_my_default_administrator_rights`, | ||
:meth:`Bot.get_my_default_administrator_rights` | ||
@@ -62,6 +67,10 @@ class ChatAdministratorRights(TelegramObject): | ||
messages of other users. | ||
can_pin_messages (:obj:`bool`, optional): :obj:`True`, if the user is allowed to pin | ||
messages; groups and supergroups only. | ||
can_manage_topics (:obj: `bool`, optional): :obj:`True`, if the user is allowed | ||
Bibo-Joshi marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
to create, rename, close, and reopen forum topics; supergroups only. | ||
.. versionadded:: 20.0 | ||
Attributes: | ||
is_anonymous (:obj:`bool`): :obj:`True`, if the user's presence in the chat is hidden. | ||
@@ -89,6 +98,10 @@ class ChatAdministratorRights(TelegramObject): | ||
messages of other users. | ||
can_pin_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to pin | ||
messages; groups and supergroups only. | ||
can_manage_topics (:obj: `bool`, optional): :obj:`True`, if the user is allowed | ||
Bibo-Joshi marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
to create, rename, close, and reopen forum topics; supergroups only. | ||
.. versionadded:: 20.0 | ||
""" | ||
__slots__ = ( | ||
@@ -103,6 +116,7 @@ class ChatAdministratorRights(TelegramObject): | ||
"can_post_messages", | ||
"can_edit_messages", | ||
"can_pin_messages", | ||
"can_manage_topics", | ||
) | ||
def __init__( | ||
@@ -118,6 +132,7 @@ def __init__( | ||
can_post_messages: bool = None, | ||
can_edit_messages: bool = None, | ||
can_pin_messages: bool = None, | ||
can_manage_topics: bool = None, | ||
*, | ||
api_kwargs: JSONDict = None, | ||
) -> None: | ||
@@ -135,6 +150,7 @@ def __init__( | ||
self.can_post_messages = can_post_messages | ||
self.can_edit_messages = can_edit_messages | ||
self.can_pin_messages = can_pin_messages | ||
self.can_manage_topics = can_manage_topics | ||
self._id_attrs = ( | ||
self.is_anonymous, | ||
@@ -148,6 +164,7 @@ def __init__( | ||
self.can_post_messages, | ||
self.can_edit_messages, | ||
self.can_pin_messages, | ||
self.can_manage_topics, | ||
) | ||
@classmethod | ||
@@ -159,7 +176,7 @@ def all_rights(cls) -> "ChatAdministratorRights": | ||
.. versionadded:: 20.0 | ||
""" | ||
return cls(True, True, True, True, True, True, True, True, True, True, True, True) | ||
@classmethod | ||
def no_rights(cls) -> "ChatAdministratorRights": | ||
@@ -169,4 +186,6 @@ def no_rights(cls) -> "ChatAdministratorRights": | ||
.. versionadded:: 20.0 | ||
""" | ||
return cls( | ||
False, False, False, False, False, False, False, False, False, False, False, False | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -215,6 +215,10 @@ class ChatMemberAdministrator(ChatMember): | ||
messages; channels only. | ||
can_pin_messages (:obj:`bool`, optional): :obj:`True`, if the user is allowed | ||
to pin messages; groups and supergroups only. | ||
can_manage_topics (:obj: `bool`, optional): :obj:`True`, if the user is allowed | ||
Bibo-Joshi marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
to create, rename, close, and reopen forum topics; supergroups only. | ||
.. versionadded:: 20.0 | ||
custom_title (:obj:`str`, optional): Custom title for this user. | ||
Attributes: | ||
@@ -252,6 +256,10 @@ class ChatMemberAdministrator(ChatMember): | ||
messages; channels only. | ||
can_pin_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed | ||
to pin messages; groups and supergroups only. | ||
can_manage_topics (:obj: `bool`, optional): :obj:`True`, if the user is allowed | ||
Bibo-Joshi marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
to create, rename, close, and reopen forum topics; supergroups only | ||
.. versionadded:: 20.0 | ||
custom_title (:obj:`str`): Optional. Custom title for this user. | ||
""" | ||
@@ -268,6 +276,7 @@ class ChatMemberAdministrator(ChatMember): | ||
"can_post_messages", | ||
"can_edit_messages", | ||
"can_pin_messages", | ||
"can_manage_topics", | ||
"custom_title", | ||
) | ||
@@ -286,6 +295,7 @@ def __init__( | ||
can_post_messages: bool = None, | ||
can_edit_messages: bool = None, | ||
can_pin_messages: bool = None, | ||
can_manage_topics: bool = None, | ||
harshil21 marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
custom_title: str = None, | ||
*, | ||
api_kwargs: JSONDict = None, | ||
@@ -303,6 +313,7 @@ def __init__( | ||
self.can_post_messages = can_post_messages | ||
self.can_edit_messages = can_edit_messages | ||
self.can_pin_messages = can_pin_messages | ||
self.can_manage_topics = can_manage_topics | ||
self.custom_title = custom_title | ||
@@ -361,6 +372,10 @@ class ChatMemberRestricted(ChatMember): | ||
to send animations, games, stickers and use inline bots. | ||
can_add_web_page_previews (:obj:`bool`): :obj:`True`, if the user is | ||
allowed to add web page previews to their messages. | ||
can_manage_topics (:obj: `bool`, optional): :obj:`True`, if the user is allowed | ||
Bibo-Joshi marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
to create, rename, close, and reopen forum topics; supergroups only | ||
.. versionadded:: 20.0 | ||
until_date (:class:`datetime.datetime`): Date when restrictions | ||
will be lifted for this user. | ||
@@ -386,6 +401,10 @@ class ChatMemberRestricted(ChatMember): | ||
to send animations, games, stickers and use inline bots. | ||
can_add_web_page_previews (:obj:`bool`): :obj:`True`, if the user is | ||
allowed to add web page previews to their messages. | ||
can_manage_topics (:obj: `bool`, optional): :obj:`True`, if the user is allowed | ||
Bibo-Joshi marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
to create, rename, close, and reopen forum topics; supergroups only | ||
.. versionadded:: 20.0 | ||
until_date (:class:`datetime.datetime`): Date when restrictions | ||
will be lifted for this user. | ||
@@ -401,6 +420,7 @@ class ChatMemberRestricted(ChatMember): | ||
"can_send_polls", | ||
"can_send_other_messages", | ||
"can_add_web_page_previews", | ||
"can_manage_topics", | ||
"until_date", | ||
) | ||
@@ -416,6 +436,7 @@ def __init__( | ||
can_send_polls: bool, | ||
can_send_other_messages: bool, | ||
can_add_web_page_previews: bool, | ||
can_manage_topics: bool, | ||
Bibo-Joshi marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
until_date: datetime.datetime, | ||
*, | ||
api_kwargs: JSONDict = None, | ||
@@ -430,6 +451,7 @@ def __init__( | ||
self.can_send_polls = can_send_polls | ||
self.can_send_other_messages = can_send_other_messages | ||
self.can_add_web_page_previews = can_add_web_page_previews | ||
self.can_manage_topics = can_manage_topics | ||
self.until_date = until_date | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -28,12 +28,17 @@ class ChatPermissions(TelegramObject): | ||
Objects of this class are comparable in terms of equality. Two objects of this class are | ||
considered equal, if their :attr:`can_send_messages`, :attr:`can_send_media_messages`, | ||
:attr:`can_send_polls`, :attr:`can_send_other_messages`, :attr:`can_add_web_page_previews`, | ||
:attr:`can_change_info`, :attr:`can_invite_users` and :attr:`can_pin_messages`, | ||
:attr:`can_manage_topics` are equal. | ||
harshil21 marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
.. versionchanged:: 20.0 | ||
:attr:`can_manage_topics` is considered as well when comparing objects of | ||
this type in terms of equality. | ||
Note: | ||
Though not stated explicitly in the official docs, Telegram changes not only the | ||
permissions that are set, but also sets all the others to :obj:`False`. However, since not | ||
documented, thisbehavior may change unbeknown to PTB. | ||
Args: | ||
can_send_messages (:obj:`bool`, optional): :obj:`True`, if the user is allowed to send text | ||
@@ -54,6 +59,10 @@ class ChatPermissions(TelegramObject): | ||
users to the chat. | ||
can_pin_messages (:obj:`bool`, optional): :obj:`True`, if the user is allowed to pin | ||
messages. Ignored in public supergroups. | ||
can_manage_topics (:obj: `bool`, optional): :obj:`True`, if the user is allowed | ||
to create, rename, close, and reopen forum topics; supergroups only | ||
Bibo-Joshi marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
.. versionadded:: 20.0 | ||
Attributes: | ||
can_send_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to send text | ||
@@ -74,6 +83,10 @@ class ChatPermissions(TelegramObject): | ||
new users to the chat. | ||
can_pin_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to pin | ||
messages. Ignored in public supergroups. | ||
can_manage_topics (:obj: `bool`): Optional. :obj:`True`, if the user is allowed | ||
to create, rename, close, and reopen forum topics; supergroups only | ||
Bibo-Joshi marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
.. versionadded:: 20.0 | ||
""" | ||
@@ -86,6 +99,7 @@ class ChatPermissions(TelegramObject): | ||
"can_change_info", | ||
"can_pin_messages", | ||
"can_add_web_page_previews", | ||
"can_manage_topics", | ||
) | ||
def __init__( | ||
@@ -98,6 +112,7 @@ def __init__( | ||
can_change_info: bool = None, | ||
can_invite_users: bool = None, | ||
can_pin_messages: bool = None, | ||
can_manage_topics: bool = None, | ||
*, | ||
api_kwargs: JSONDict = None, | ||
): | ||
@@ -111,6 +126,7 @@ def __init__( | ||
self.can_change_info = can_change_info | ||
self.can_invite_users = can_invite_users | ||
self.can_pin_messages = can_pin_messages | ||
self.can_manage_topics = can_manage_topics | ||
self._id_attrs = ( | ||
self.can_send_messages, | ||
@@ -121,6 +137,7 @@ def __init__( | ||
self.can_change_info, | ||
self.can_invite_users, | ||
self.can_pin_messages, | ||
self.can_manage_topics, | ||
) | ||
@classmethod | ||
@@ -133,7 +150,7 @@ def all_permissions(cls) -> "ChatPermissions": | ||
.. versionadded:: 20.0 | ||
""" | ||
return cls(True, True, True, True, True, True, True, True, True) | ||
@classmethod | ||
def no_permissions(cls) -> "ChatPermissions": | ||
@@ -143,4 +160,4 @@ def no_permissions(cls) -> "ChatPermissions": | ||
.. versionadded:: 20.0 | ||
""" | ||
return cls(False, False, False, False, False, False, False, False, False) |
Uh oh!
There was an error while loading.Please reload this page.