Ban, unban user or chat
You can ban and unban chat member
To ban the user, use .ban
answer/api method or Ban class-method. To unban the user, use .unban
answer/api method. This is an example where we ban a user if they type "****" in the chat and unban after 5 seconds
Using these methods, you can also ban users who write via chats
Ban class-method or .ban Answer method take arguments:
Argument | Description | Required |
---|---|---|
1 | Until ban date (unix date). If a user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only | Optional |
2 | Revoke messages. Pass | Optional |
3 | User ID you want to ban | Optional. Current user id by default |
.unban Answer method take arguments:
Argument | Description | Required |
---|---|---|
1 | Only if banned. Do nothing if user is unbanned | Optional |
2 | User id you want to unban | Optional. Current user id by default |
If you want to know what arguments Api methods takes, see IDE hints
Last updated