yagop / telegram-bot

UNMAINTAINED - A Telegram Bot based on plugins
GNU General Public License v2.0
848 stars 502 forks source link

Is there anyway to block spam messages? #284

Open alixrx opened 9 years ago

alixrx commented 9 years ago

Hi. Not programming question! There is a guy who keep spamming message to my bot. is there anyway i can block that ID? It's ok but really annoying. There is no method for blocking in telegram bot api.

MasterGroosha commented 9 years ago

Speaking of newest Bot API, you can easily find out his chat_id (f.ex. manually call getUpdates method) and add a rule, that if recieved chat_id is his chat_id - do nothing.

yagop commented 9 years ago

I assume he is speaking about this implementation. There is an anti-flood implemented: https://github.com/yagop/telegram-bot/blob/master/plugins/stats.lua#L103 The message is ignored if the user messages > NUM_MSG_MAX in TIME_CHECK (s)