Home

Awesome

<h1 align="center">🛡️telegram-captcha🛡️</h1> <div align="center">

Protect telegram groups from automated bots.

Bot API npm package npm download

</div>

📙 Description

After joining/request to join a telegram group, the user is sent a captcha message, which must be completed within 5 minutes. Otherwise, the user will be banned from the group for a day.

<div align="center"> <img src="https://github.com/VDS13/telegram-captcha/blob/main/img/demo1.gif" width="300"/> <img src="https://github.com/VDS13/telegram-captcha/blob/main/img/demo2.gif" width="300"/> </div>

Supported languages:

Supported Telegram bot libraries:

📦 Install

npm i telegram-captcha

🎚️ Changelog

🗺 API

🚀 Usage

node-telegram-bot-api

Open group

const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';

import { GroupCaptcha } from 'telegram-captcha';

const captcha = new GroupCaptcha(TOKEN, {polling: true}, {
    size: 6,
    language: 'de',
    time_for_enter: 3
});

captcha.bot.on("new_chat_members", (msg) => captcha.generateCaptcha(msg));
captcha.bot.on("callback_query", (query) => captcha.clickKeyboard(query));

Group with requests to join

const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';

import { GroupCaptchaRTJ } from 'telegram-captcha';

const captcha = new GroupCaptchaRTJ(TOKEN, {polling: true}, {
    size: 5,
    language: 'es',
    time_for_enter: 7
});

captcha.bot.on("chat_join_request", (cjr) => captcha.generateCaptcha(cjr));
captcha.bot.on("callback_query", (query) => captcha.clickKeyboard(query));

⚙️ Default options

GroupCaptcha/GroupCaptchaRTJ

{
    size: 4,                     //Captcha length < 9 (number of characters)
    language: 'en',              //Language (en/es/de/es/fr/it)
    time_for_enter: 5            //Time for enter captcha (in minutes)
}

☑️ Todo:

License

The MIT License (MIT)

Copyright © 2023-2024 Dmitry Vyazin