Skip to content

zakaria-chahboun/telegram_gatekeeper_bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Saalim Gatekeeper Bot

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.

Bot Icon

Features

  • Timed math problem to filter out unwanted or spam users.
  • Supports Arabic language messages.
  • Uses environment variables for configuration.

Flow

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]
Loading

Getting Started

Prerequisites

  • Go 1.20 or later
  • A Telegram bot token from BotFather

Installation

  1. Clone the repository:
git clone https://github.com/zakaria-chahboun/telegram_gatekeeper_bot.git
cd telegram_gatekeeper_bot
  1. Install dependencies:
go mod tidy
  1. 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
  1. Run the bot:
go run main.go

Usage

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.

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Telegram Gatekeeper Bot

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages