banChatMember
Remove a user from a group, supergroup, or channel by banning them. Requires admin rights; optionally schedule unban and revoke their messages to maintain chat safety.
Instructions
Ban a user in a group, supergroup or channel. The bot must be an administrator with the appropriate rights. Returns True on success.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chat_id | Yes | Unique identifier for the target chat or username of the target supergroup/channel (in the format @channelusername) | |
| user_id | Yes | Unique identifier of the target user | |
| until_date | No | Date when the user will be unbanned (Unix timestamp). If user is banned for more than 366 days or less than 30 seconds from the current time, they are considered banned forever. Applied for supergroups and channels only. | |
| revoke_messages | No | Pass True to delete all messages from the chat for the user that is being removed. If False, the user will be able to see messages in the group that were sent before the user was removed. Always True for supergroups and channels. |