на русском

A. Telegram Assistant: Brief Description

Telegram Assistant is a bot that monitors messages in your Telegram group around the clock.

Each time a keyword from your list is found in messages, the bot sends you a notification.
Also, the bot can automatically delete messages, such as spam, hate or swearing.
In addition, the bot can remove the authors of such messages from the group and block them.

Or vice versa, you may receive notifications of messages on a topic of interest to you.

Of course the owner of a chat or group can keep track of the necessary messages, but with a large number of group members, this is difficult, so the bot can be of great help here.

You can replenish or change the list of keywords at any time, as well as set the type of reaction to such messages (Notification, Deletion, Blocking).

B. Procedure

  1. Install Telegram Assistant add-on if you haven’t already.
  2. Create a copy of the Telegram Assistant (WebApp) spreadsheet.
    Please DO NOT rename the «DebugLog» and «Settings» sheets.
  3. Create a Telegram bot according to How to create a bot? and BotFather.
  4. In cell A2 Settings sheet enter the bot’s API Token.
  5. Make the bot the admin of the group it should monitor.
  6. In the bot settings in the group, allow it to delete messages.
  7. In the created copy of the Telegram Assistant (WebApp) spreadsheet, select the menu item Extensions / Apps Script.
  8. Deploy the script as a web application with permissions: Execute as: Me, Who has access: Anyone.
  9. Give all necessary permissions. This is done 1 time at the first start.
  10. Copy the web application URL and paste into cell C2 Settings sheet.
  11. Now set up a trigger that will watch for new messages in the DebugLog sheet and look for keywords in them. To do this, Extensions / Telegram Assistant menu select Set Up. Give all necessary permissions.
  12. Check if everything is done correctly. To do this, send any text to the group.
  13. A new line appears in the DebugLog sheet. In the Date column — the date the message was sent, in Chat Name — the name of the group, in Chat Id — its identifier, in User First name — the sender’s name, in User Id — the sender’s identifier, in Message — the text of the message, in Message Id — the message identifier.
  14. Since you sent this message, the User Id is your identifier. Paste your ID into cell B2 Settings sheet. So the bot will know who to send notifications to.
  15. Enter your keywords in cells A6, A7 and below.
  16. Check the appropriate boxes in the columns Alarm, Delete and Ban next to the keywords. If you check the Alarm, then when a keyword is found in the message text, an alarm message will be sent to you. If you check the Delete, then when a keyword is found in the message text, this message will be deleted automatically. If you check the Ban, then when a keyword is found in the message text, this user will be blocked automatically.
  17. Do another check. To do this, send a text to the group containing one of the keywords, which has a checkmark in the Alarm. A notification will be sent to you.
  18. Send text to the group that contains one of the keywords that has a checkmark in the Delete. This message will be removed from the group automatically.
  19. Send a text to the group that contains one of the keywords that is checked in the Alarm and in the Ban. An alert message will be sent to you, and the user itself will be blocked in the group automatically. Note that the group owner cannot be blocked. Therefore, for verification, you can ask someone else to write the forbidden word.
  20. To unlock, the user must write any message to the bot. After that, make sure that the row with its message is the last row on the DebugLog sheet. To do this, you can delete the extra or copy the row with its data to the end of the sheet. Then, in the Extensions / Telegram Assistant menu, select UnBan User. The user will be unblocked and sent a message with an invitation link to join the group.

Video for those who like to watch😉


May 21, 2022, updates:

  1. The sequence of actions has been shortened, the Set Webhook and Set trigger items have been merged into one Set Up.
  2. Added the ability to automatically block a user and unblock him from the menu.

Video 2 — updated procedure + lock/unlock.


Telegram Assistant: PRIVACY POLICY

0 комментариев

Добавить комментарий

Заполнитель аватара

Ваш адрес email не будет опубликован. Обязательные поля помечены *

Этот сайт использует Akismet для борьбы со спамом. Узнайте, как обрабатываются ваши данные комментариев.