New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

telegram-captcha

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

telegram-captcha

Protect telegram groups from automated bots.


Version published
Weekly downloads
9
decreased by-43.75%
Maintainers
1
Weekly downloads
 
Created

🛡️telegram-captcha🛡️

Protect telegram groups from automated bots.

Bot API npm package npm download

📙 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.

Supported languages:

  • English
  • French
  • Russian
  • Spanish
  • Italian
  • German

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 TelegramBot from 'node-telegram-bot-api';
import { GroupCaptcha } from 'telegram-captcha';
process.env["NTBA_FIX_350"] = 1;
process.env["NTBA_FIX_319"] = 1
const bot = new TelegramBot(TOKEN, {polling: true});
const captcha = new GroupCaptcha(bot, {
    size: 6,
    language: 'de',
    time_for_enter: 3
});

bot.on("new_chat_members", (msg) => captcha.generateCaptcha(msg));
bot.on("callback_query", (query) => captcha.clickKeyboard(query));
Group with requests to join
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';

import TelegramBot from 'node-telegram-bot-api';
import { GroupCaptchaRTJ } from 'telegram-captcha';
process.env["NTBA_FIX_350"] = 1;
process.env["NTBA_FIX_319"] = 1
const bot = new TelegramBot(TOKEN, {polling: true});
const captcha = new GroupCaptchaRTJ(bot, {
    size: 5,
    language: 'es',
    time_for_enter: 7
});

bot.on("chat_join_request", (cjr) => captcha.generateCaptcha(cjr));
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:

  • Captcha for an open group
  • Captcha for a group with requests to join
  • Option "size"
  • Option "ban time"
  • Option "time for enter captcha"
  • Support Telegraf/grammY/telebot
  • reCaptcha
  • Other types of captcha

License

The MIT License (MIT)

Copyright © 2023 Dmitry Vyazin

FAQs

Package last updated on 08 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts