Chat.restrict_member()

Chat.restrict_member()

Bound method unban_member of Chat.

Use as a shortcut for:

client.restrict_chat_member(
    chat_id=chat_id,
    user_id=user_id
)

Example

chat.restrict_member(123456789)
Parameters
  • user_id (int | str) – Unique identifier (int) or username (str) of the target user. For a contact that exists in your Telegram address book you can use his phone number (str).

  • until_date (int, optional) – Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Defaults to 0 (ban forever).

  • can_send_messages (bool, optional) – Pass True, if the user can send text messages, contacts, locations and venues.

  • can_send_media_messages (bool, optional) – Pass True, if the user can send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages.

  • can_send_other_messages (bool, optional) – Pass True, if the user can send animations, games, stickers and use inline bots, implies can_send_media_messages.

  • can_add_web_page_previews (bool, optional) – Pass True, if the user may add web page previews to their messages, implies can_send_media_messages.

  • can_send_polls (bool, optional) – Pass True, if the user can send polls, implies can_send_media_messages.

  • can_change_info (bool, optional) – Pass True, if the user can change the chat title, photo and other settings.

  • can_invite_users (bool, optional) – Pass True, if the user can invite new users to the chat.

  • can_pin_messages (bool, optional) – Pass True, if the user can pin messages.

Returns

Chat – On success, a chat object is returned.

Raises

RPCError – In case of a Telegram RPC error.