Chat.ban_member()¶
- Chat.ban_member()¶
Bound method ban_member of
Chat.Use as a shortcut for:
await client.ban_chat_member( chat_id=chat_id, user_id=user_id )
Example
await chat.ban_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 (
datetime, optional) – Date when the user will be unbanned. 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 epoch (ban forever).revoke_messages (
bool, optional) – Pass True to delete all messages in the chat for the user who is being removed.
- Returns:
Message|bool– On success, a service message will be returned (when applicable), otherwise, in case a message object couldn’t be returned, True is returned.- Raises:
RPCError – In case of a Telegram RPC error.