Best telegram bot ever
Best telegram bot ever
TelegramGuardian was created as a bot to support Telegram group administrators efforts while fighting with antisocial behaviour and group being attacked by spammers and simply - idiots. It’s current, fourth version has been rewritten from scratch using Google Go language and various API’s. Bot itself runs on Kubernetes cluster in Google Cloud to ensure its 24/7 availability and uptime.
Table of contents
- How to start
- What does it do
- Available commands
- Commands examples
- Live statistics
How to start
Simply invite @littleGuardianBot to your group and give it group admin rights - it will start working straight away with default settings applied.
What does it do?
Project TelegramGuardian ( in the current state of code, as of 12/05/2018 ) can ( and it does it blazingly fast! ):
- Check context of messages for the non-english messages
- Chat with other group members for entertainment purposes
- Greets new members
- Bans other bots from entering the group
- Provides group members with invitation link
- Gives ‘emergency’ trigger for notifying admins
- Deletes all the text messages for voice-only groups
- Filters obscene / nude images
- Filters invitation links to other groups
- Filters and scans attachments sent to group for viruses
- Uses incremental limits when violation occurs
/link- sends link to current the group
/admins- notifies all the administrators of the group. It can be useful in case of “emergency” when administrators attention is required immediately.
Every administrator of the group can issue following commands and change the bot settings.
/commands- displays list of available commands
/version- displays version of the bot with it’s current statistics
/settings- displays current settings for the group
/set limit_*- sets duration of the limit in minutes. Available limits:
limit_short( not used currently:
/set languages( values: on, off ) - toggle foreign languages filtering This function uses /limit_short/ value
/set otherbots( values: on, off ) - toggle checks for other bots joining
/set noinvites( values: on, off ) - toggle checks on invitation links to other groups
/set greetings( values: on, off ) - toggle greeting of new members with generic message
/set link( value: link to the group ) - if not set manually, bot will determine current link to the group on it’s own. Link will be used for link command and also to determine if links posted in the group should be deleted
/set pornfilter( values: on, off ) - toggle checks on posted pictures using Google Vision & Safe Search API’s. This function uses /limit_short/ value.
/set notext( values: on, off) - to be used with text-only groups. Bot will remove all the text messages as soon as they appear.
Enable kicking other bots from the group as soon as they enter.
Set group link to following. This link will be treated as the only allowed group link in the chat, assuming that
/set noinvites is set to on.
/set link http://t.me/joinchat/abc
Set limit ‘very_short’ to 5 minutes - this limit is used by bot to determine minor offences.
/set limit_very_short 5
How bot treats rules violation?
When violation of group rules is detected spammer receive a warning and is “limited” in the group for certain amount of time. For example - when spammer uses Farsi language in the group - he will be limited for 1 minute. This approach doesn’t work well with bot spammers, obviously, hence the incremental limits. Bot always checks last “cool down period” for the user and adds additional limit on top of that. While creating the bot I’ve made additional assumption - anyone who enters the group and starts from violation should be banned instantly as in most of the cases he’s just a spammer. That’s why bot calculates the ratio of messages sent by user and compares it to the total warnings obtained by user in that period. Following formula should help you understand when user will be banned automatically:
(( $sent_messages < 3 ) OR ( $total_limit / $sent_messages > 3.0 )) AND $currently_applied_limit > 1 minute ) OR $sent_messages > 5 AND ( $total_limit / $sent_messages ) >= 1.0)
From quick calculations it is visible that user must meet one of following:
- start violating group rules from the moment of entering it
- only messages sent by user are violations In this case we can clearly establish that user is not going to cooperate with group rules and there’s no need to keep him there.
Why bot does not kick out spammers instantly?
There is no point. We have seen groups decimated by rogue bot when users wanted to have a little bit of fun or needed to share something ‘very important’. In general - it’s better to warn and limit than kick out instantly.
How does pornfilter work?
Bot checks every picture uploaded to the group with Google algorithms. Think about it as switching ‘Safe Search’ for Google on. If you think that you won’t see that picture in results - it shouldn’t be on the group.
How does antivirus filter work?
Bot uploads files sent to the groups ( pretty often documents or android APK files ) against over 60 different virus detection engines, using VirusTotal. It’s quick, it’s efficient and most imporantly - it works. When virus is detected in the file uploaded to the group - bot displays additional information asking users who could have downloaded it to delete it. When file is “clean” - it displays information that it should be safe to download.
- Messages processing statistics
- Incoming messages rate
- Active users within last hour
- Actions taken on messages
- Cluster CPU usage and deployment history
Message bot author on telegram with clear description of your issue.