Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent a Telegram bot from being added to any group or channel (allow adding it to whitelisted groups/channels)

As far as I read the Telegram Bot API's docs, Telegram do not limit the calls to your webhook callback in any way.

I am creating a Telegram Bot that will be available only for groups and channels that I will whitelist.

I can filter out the messages I get in my webhook callback. However, a malicious user can add my bot to a thousand big groups and will possibly result in denial of service for all other users.

Even if Telegram have implemented some rate limiting such user actions may still result in denial of service for all other users.

How can I specify the groups and the channels a Telegram bot can be added to.

like image 243
Boris D. Teoharov Avatar asked Sep 17 '18 14:09

Boris D. Teoharov


People also ask

How can I protect my Telegram channel from bots?

You can do it using BotFather: /setjoingroups — toggle whether your bot can be added to groups or not. Any bot must be able to process private messages, but if your bot was not designed to work in groups, you can disable this.

Can Telegram Bot add people to group?

So let's get started. Disclaimer: Telegram does not allow adding more than 200 members to a group or channel by one account. Using this script, I am able to add around 150-200 members with 60 second sleep between each add; after that, you have to change to another Telegram account/number.

How can I lock my Telegram group?

5) Lock your chats Along with end-to-end encryption, Telegram also allows its users to lock their chats. To enable the passcode lock feature on your Telegram account, go to Settings > Privacy and Security > Passcode Lock, and toggle it on.


2 Answers

That feature does not exist. Either you allow all or none.

In addition to filtering, you could use leaveChat to immediately leave groups that are not on your whitelist.

And there is privacy mode which could make it harder for a malicious user.

like image 156
cuzi Avatar answered Nov 10 '22 11:11

cuzi


You can do it using BotFather:

/setjoingroups — toggle whether your bot can be added to groups or not. Any bot must be able to process private messages, but if your bot was not designed to work in groups, you can disable this.

https://core.telegram.org/bots

like image 24
wcoder Avatar answered Nov 10 '22 13:11

wcoder