This project is a Telegram bot designed to enhance group management by monitoring new members, applying temporary restrictions, and sending welcome messages after the restriction period.
- 🕵️ New Member Detection: Automatically detects when new members join the group.
- ⏳ Temporary Restriction: Restricts new members from sending messages for 12 hours after a waiting period of 7 minutes.
- 👋 Welcome Message: Sends a personalized welcome message mentioning the user after the 12-hour restriction period ends, provided the user is still in the group.
- 📝 Logging: Includes detailed logging for monitoring bot actions and debugging.
-
Clone the repository:
git clone https://github.com/CyberScopeToday/telegram-restriction-bot.git cd telegram-restriction-bot
-
Set up Python environment: Ensure you have Python 3.7+ installed.
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate` pip install -r requirements.txt
-
Add your Telegram bot token: Replace the placeholder token in
main.py
:application = ApplicationBuilder().token("YOUR_TELEGRAM_BOT_TOKEN").build()
-
Run the bot:
python main.py
- Start Command:
/start
– Initializes the bot and confirms it is running. - New Member Handling: The bot automatically tracks new members and starts the restriction process.
- Delay and Restriction Time: The waiting time before restriction is 7 minutes, and the restriction duration is 12 hours.
- Welcome Message Customization: The message text can be modified in the
schedule_welcome_message
function.
Logs are set up to provide detailed output. You can change the logging level by adjusting:
logging.basicConfig(level=logging.INFO) # Use DEBUG for more detailed logs
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
Distributed under the MIT License. See LICENSE
for more information.