@@ -26,6 +26,15 @@ class ChatPermissions(Object):
2626 Some permissions make sense depending on the context: default chat permissions, restricted/kicked member or
2727 administrators in groups or channels.
2828
29+ .. note::
30+
31+ Pyrogram's chat permission are much more detailed. In particular, you can restrict sending stickers, animations,
32+ games and inline bot results individually, allowing a finer control.
33+
34+ If you wish to have the same permissions as seen in official apps or in bot API's *"can_send_other_messages"*
35+ simply set these arguments to True: ``can_send_stickers``, ``can_send_animations``, ``can_send_games`` and
36+ ``can_use_inline_bots``.
37+
2938 Parameters:
3039 can_send_messages (``bool``, *optional*):
3140 True, if the user is allowed to send text messages, contacts, locations and venues.
@@ -34,9 +43,17 @@ class ChatPermissions(Object):
3443 True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies
3544 can_send_messages.
3645
37- can_send_other_messages (``bool``, *optional*):
38- True, if the user is allowed to send animations, games, stickers and use inline bots, implies
39- can_send_media_messages
46+ can_send_stickers (``bool``, *optional*):
47+ True, if the user is allowed to send stickers, implies can_send_media_messages.
48+
49+ can_send_animations (``bool``, *optional*):
50+ True, if the user is allowed to send animations (GIFs), implies can_send_media_messages.
51+
52+ can_send_games (``bool``, *optional*):
53+ True, if the user is allowed to send games, implies can_send_media_messages.
54+
55+ can_use_inline_bots (``bool``, *optional*):
56+ True, if the user is allowed to use inline bots, implies can_send_media_messages.
4057
4158 can_add_web_page_previews (``bool``, *optional*):
4259 True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages.
@@ -61,7 +78,10 @@ def __init__(
6178 * ,
6279 can_send_messages : bool = None , # Text, contacts, locations and venues
6380 can_send_media_messages : bool = None , # Audios, documents, photos, videos, video notes and voice notes
64- can_send_other_messages : bool = None , # Animations (GIFs), games, stickers, inline bot results
81+ can_send_stickers : bool = None ,
82+ can_send_animations : bool = None ,
83+ can_send_games : bool = None ,
84+ can_use_inline_bots : bool = None ,
6585 can_add_web_page_previews : bool = None ,
6686 can_send_polls : bool = None ,
6787 can_change_info : bool = None ,
@@ -72,7 +92,10 @@ def __init__(
7292
7393 self .can_send_messages = can_send_messages
7494 self .can_send_media_messages = can_send_media_messages
75- self .can_send_other_messages = can_send_other_messages
95+ self .can_send_stickers = can_send_stickers
96+ self .can_send_animations = can_send_animations
97+ self .can_send_games = can_send_games
98+ self .can_use_inline_bots = can_use_inline_bots
7699 self .can_add_web_page_previews = can_add_web_page_previews
77100 self .can_send_polls = can_send_polls
78101 self .can_change_info = can_change_info
@@ -85,10 +108,10 @@ def _parse(denied_permissions: types.ChatBannedRights) -> "ChatPermissions":
85108 return ChatPermissions (
86109 can_send_messages = not denied_permissions .send_messages ,
87110 can_send_media_messages = not denied_permissions .send_media ,
88- can_send_other_messages = (
89- not denied_permissions .send_stickers or not denied_permissions . send_gifs or
90- not denied_permissions .send_games or not denied_permissions . send_inline
91- ) ,
111+ can_send_stickers = not denied_permissions . send_stickers ,
112+ can_send_animations = not denied_permissions .send_gifs ,
113+ can_send_games = not denied_permissions .send_games ,
114+ can_use_inline_bots = not denied_permissions . send_inline ,
92115 can_add_web_page_previews = not denied_permissions .embed_links ,
93116 can_send_polls = not denied_permissions .send_polls ,
94117 can_change_info = not denied_permissions .change_info ,
0 commit comments