Skip to content

About

A Python bot that monitors a Telegram supergroup for specific keywords and notifies the admin when they appear in recent messages.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

Repository files navigation

Telegram Watchword Bot

A Python bot that monitors a Telegram supergroup for specific keywords and notifies the admin when they appear in recent messages.


Features

  • Connects to Telegram using python-telegram-bot.
  • Monitors the last messages in a specified supergroup.
  • Checks for predefined watch words.
  • Sends a notification to the admin when a keyword is found.

Requirements

Install dependencies via pip:

pip install python-telegram-bot --upgrade

Setup

  1. Clone the repository:
git clone https://github.com/your-username/telegram-watchword-bot.git
cd telegram-watchword-bot
  1. Create a .env file in the project root with the following variables:
BOT_TOKEN=your_bot_token_here
ADMIN_USER_ID=your_telegram_user_id
  1. Update the GROUP_CHAT_ID and WATCH_WORDS in the script as needed:
GROUP_CHAT_ID =  # Supergroup ID
WATCH_WORDS = [""]

Usage

Run the bot script:

python telegram_watchword_bot.py
  • The bot checks the most recent messages in the group.
  • If any message contains a watch word, a notification is sent to the admin.
  • Designed to be run periodically or via a scheduler.

Notes

  • Ensure the bot has permission to read messages in the target group.
  • Watch words are case-insensitive.
  • You can adjust the number of recent messages to check via the limit parameter in get_chat_history.

License

This project is licensed under the MIT License.

About

A Python bot that monitors a Telegram supergroup for specific keywords and notifies the admin when they appear in recent messages.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages