Daysandbox Bot

daysandbox_bot telegram bot

Daysandbox Bot is simple yet effective anti-spam bot. The idea is to delete links, media and forwarded messages written by users joined chatroom in less than 24 hours ago. This technique allows to delete most of spam messages from new users. Downside of this approach is that any chat member older than 1 day can post anything. This is tradeoff between simplicity and efficiency. You get for free a tool that automatically removes lot of spam messages but not all of it. You can set list of domains and groups/channels which should never be blocked. You can add new member of chat to whitelist if you want to allow him to post links before safe period expired. Deleting media messages is disabled by default, read Commands to see how to enable removing media messages from new users. Also you can mute new users for a number of hours with mute_hours option.

Type of messages counted by Daysandbox Bot as possible spam:

  • message forwarded from another chat
  • message contains link to some web document
  • message contains @username mention pointing to a group or to a channel. If @username points to some user then it is not counted as link.
  • message contains button of any type. Usually such messages are posted via inline bots
  • media messages, disabled by default. Media are audio, game, animation, document, photo, video, voice, video note, contact, location

Install

Follow these steps:

  • Add @daysandbox_bot as admin into your chatroom
  • Give bot a permission to delete messages. No other permissions are required
  • Optional step: setup white list of domains and groups/channels.
  • Optional step: enable deleting media messages from new users

Commands

  • /daysandbox set notify_actions=yes - set bot to write messages into chatroom about each removed spam message
  • /daysandbox set notify_actions=no - set bot to remove spam messages silently
  • /daysandbox set remove_media=yes - configure bot to remove media messages from new users (it is NO by default)
  • /daysandbox set remove_media=no - configure bot to NOT remove media messages from new users
  • /daysandbox set safe_hours=X - set safe period to X hours. X value should be a number in range 0 < X < 720. In other words, safe period should be grater than zero and less or equal to one month.
  • /daysandbox set mute_hours=X - mute new users completely for a specified number of hours. By default it is zero hours i.e. new users are not muted. Valid value for this option is in range from 0 to 720.
  • /daysandbox config - display bot config for current chat
  • /daysandbox check - check if bot installed correctly
  • /daysandbox reload_admins - ask bot to reload admin IDs for current chat. Admins list is collected once and cached. Use this command to update cached data.
  • /daysandbox add domain-whitelist FOO - tell bot to never block links that contains FOO. FOO can be domain.name or username of group/channel. Use "@" chat to specify group/channels usernames. Example: /daysandbox add domain-whitelist google.com or /daysandbox add domain-whitelist @tgdev_en.
  • /daysandbox remove domain-whitelist FOO - remove FOO from list of domains/groups/channels which should never be blocked. Example: /daysandbox remove domain-whitelist yahoo.com
  • /daysandbox ad user-whitelist USER - tell bot to not block messages from user. USER must be username with leading "@". Example: /daysandbox add user-whitelist @foobar
  • /daysandbox remove user-whitelist USER - remove USER from whitelist. Example: /daysandbox remove user-whitelist @foobar
  • /daysandbox set lang=<lang-code> - setup language of notifications. Valid values for this settings is en and ru.

All these commands have to be entered in chatroom you want to configure (where bot is installed).

FAQ

How to check if bot works?

First, complete installation instructions. Then type into chat this command: /daysandbox check. Fix any issues bot talkes about.

Is it possible to make bot not delete posts sent by admin?

Admin can just wait for 24 hours and then post links. If you want to delete any link anytime from anybody except admins then just use !BOT_LINK:watchdog_robot!

Bot does not deletes some spam

Bot deletes links only from new users. If user is in chat for more than 24 hours then bot will not delete any message from such user. Also bot does not process any message from users that were in the chat on the moment whent bot was added to the chat. This is because bot can't find out join time of old users, it can do it only for new users that join the chat where bot works already.

Bot does not work

It works. Every day @daysandbox_bot deletes about 50-70 thousand spam messages.

Bot banned some user in my group by mistake

Daysandbox does not ban anybody. There is no such feature in the bot.

Daysandbox does not log deleted messages to my channel

This feature has been removed from daysandbox.

How to allow new users to post links immediately

If you want new user to post links immediately (and not waiting for safe period) then add his username to user whitelist with command /daysandbox add user-whitelist @username.

How to allow new users to post link to a specific domain

If you want @daysandbox_bot to now block links to custom domain or telegram group then add this domain/group username to whitelist with command /daysandbox add domain-whitelist FOO where FOO is domain name or username (with leading "@") of group/channel.

Bot does not delete links from admins

Bot does not delete anything from admin users.