MCPcopy Index your code
hub / github.com/python-telegram-bot/python-telegram-bot / ChatPermissions

Class ChatPermissions

src/telegram/_chatpermissions.py:30–275  ·  view source on GitHub ↗

Describes actions that a non-administrator user is allowed to take in a chat. 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_polls`, :attr:`can_send_other_messages`, :attr:`ca

Source from the content-addressed store, hash-verified

28
29
30class ChatPermissions(TelegramObject):
31 """Describes actions that a non-administrator user is allowed to take in a chat.
32
33 Objects of this class are comparable in terms of equality. Two objects of this class are
34 considered equal, if their :attr:`can_send_messages`,
35 :attr:`can_send_polls`, :attr:`can_send_other_messages`, :attr:`can_add_web_page_previews`,
36 :attr:`can_change_info`, :attr:`can_invite_users`, :attr:`can_pin_messages`,
37 :attr:`can_send_audios`, :attr:`can_send_documents`, :attr:`can_send_photos`,
38 :attr:`can_send_videos`, :attr:`can_send_video_notes`, :attr:`can_send_voice_notes`,
39 :attr:`can_manage_topics`, :attr:`can_edit_tag`, and :attr:`can_react_to_messages` are equal.
40
41 .. versionchanged:: 20.0
42 :attr:`can_manage_topics` is considered as well when comparing objects of
43 this type in terms of equality.
44 .. versionchanged:: 20.5
45
46 * :attr:`can_send_audios`, :attr:`can_send_documents`, :attr:`can_send_photos`,
47 :attr:`can_send_videos`, :attr:`can_send_video_notes` and :attr:`can_send_voice_notes`
48 are considered as well when comparing objects of this type in terms of equality.
49 * Removed deprecated argument and attribute ``can_send_media_messages``.
50 .. versionchanged:: 22.7
51 :attr:`can_edit_tag` is considered as well when comparing objects of
52 this type in terms of equality.
53 .. versionchanged:: 22.8
54 :attr:`can_react_to_messages` is considered as well when comparing objects of
55 this type in terms of equality.
56
57
58 Note:
59 Though not stated explicitly in the official docs, Telegram changes not only the
60 permissions that are set, but also sets all the others to :obj:`False`. However, since not
61 documented, this behavior may change unbeknown to PTB.
62
63 Args:
64 can_send_messages (:obj:`bool`, optional): :obj:`True`, if the user is allowed to send text
65 messages, contacts, locations and venues.
66 can_send_polls (:obj:`bool`, optional): :obj:`True`, if the user is allowed to send polls.
67 can_send_other_messages (:obj:`bool`, optional): :obj:`True`, if the user is allowed to
68 send animations, games, stickers and use inline bots.
69 can_add_web_page_previews (:obj:`bool`, optional): :obj:`True`, if the user is allowed to
70 add web page previews to their messages.
71 can_change_info (:obj:`bool`, optional): :obj:`True`, if the user is allowed to change the
72 chat title, photo and other settings. Ignored in public supergroups.
73 can_invite_users (:obj:`bool`, optional): :obj:`True`, if the user is allowed to invite new
74 users to the chat.
75 can_pin_messages (:obj:`bool`, optional): :obj:`True`, if the user is allowed to pin
76 messages. Ignored in public supergroups.
77 can_manage_topics (:obj:`bool`, optional): :obj:`True`, if the user is allowed
78 to create forum topics. If omitted defaults to the value of
79 :attr:`can_pin_messages`.
80
81 .. versionadded:: 20.0
82 can_send_audios (:obj:`bool`): :obj:`True`, if the user is allowed to send audios.
83
84 .. versionadded:: 20.1
85 can_send_documents (:obj:`bool`): :obj:`True`, if the user is allowed to send documents.
86
87 .. versionadded:: 20.1

Callers 8

test_restrict_memberMethod · 0.90
chat_permissionsFunction · 0.90
chat_permissionsFunction · 0.90
test_equalityMethod · 0.90
test_all_permissionsMethod · 0.90
test_no_permissionsMethod · 0.90
build_kwargsFunction · 0.90

Calls

no outgoing calls

Tested by 6

test_restrict_memberMethod · 0.72
chat_permissionsFunction · 0.72
chat_permissionsFunction · 0.72
test_equalityMethod · 0.72
test_all_permissionsMethod · 0.72
test_no_permissionsMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…