Telegram group ban/boot/kick user
Asked Answered
O

2

7

I need to create a Telegram bot to moderate a group and be able to ban/boot/kick users from the group.

I could not find anything in the Telegram API to boot a user from a group, how can a bot do this through the API?

Ocampo answered 2/10, 2016 at 12:38 Comment(0)
K
14

You can use banChatMember to remove a user from a group.

The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.

Keenankeene answered 2/10, 2016 at 13:13 Comment(5)
Looks like this method does not remove user from group and user is still visible in members list.Kieger
After almost two hours of trying to figure out what's going on I removed bot from group and added it again. And now it works. I'm so angry right now.Kieger
try this adby.io/add-telegram-bots-to-groups/…Effervesce
I'm facing the same problem, the API call just get's ignored. The bot has sufficient privileges. The method returns True. Do you know what fixed it for you? Also using banChatMember has no effect.Ader
link is broken!Eden
A
2

To remove a user without banning them, use unbanChatMember.

this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat.

Acinus answered 18/7, 2022 at 23:25 Comment(1)
from documentation it seems that this method is to be used on a previously banned user.Milka

© 2022 - 2024 — McMap. All rights reserved.