Note
If you're an Arabic speaker, please visit the Arabic documentation.
This is a Telegram bot built using Go, designed to serve as a gatekeeper for group chats. The bot ensures that only valid users can join by requiring them to choose the correct option or solve a math problem within a limited time.
- Timed math problem to filter out unwanted or spam users.
- Supports Arabic language messages.
- Uses environment variables for configuration.
This is the flow of verification
graph TD
A[New Member Joins Group] --> B[Restricted from Sending Messages]
B --> C[Receives Button]
C --> D[Button Clicked]
D --> E[Redirected to BOT Chat]
E --> F[Start Verification - Simple Math Operation]
F --> G{Correct Answer?}
G -->|Yes| H[Granted Chat Privileges]
H --> I[BOT Sends Welcome Message to Group]
G -->|No| J[Removed from Group]
F --> K{Timeout After 15 Seconds}
K -->|Timeout| J[Removed from Group]
C --> L[Message Deleted After 20 Seconds]
Prerequisites
- Go 1.20 or later
- A Telegram bot token from BotFather
- Clone the repository:
git clone https://github.com/zakaria-chahboun/telegram_gatekeeper_bot.git
cd telegram_gatekeeper_bot
- Install dependencies:
go mod tidy
- Set up environment variables:
Create a .env
file in the root directory of the project and add your environment variables:
BOT_TOKEN=your-telegram-bot-token
- Run the bot:
go run main.go
Once the bot is running, it will automatically monitor new users joining your group. When a new user attempts to join, the bot will prompt them with a validation process. If they fail to answer correctly within the time limit, they will be prevented from joining.
Contributions are welcome! Feel free to open issues or submit pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.