Git Product home page Git Product logo

telegram-captcha's Introduction

🛡️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 { 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:

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

License

The MIT License (MIT)

Copyright © 2023 Dmitry Vyazin

telegram-captcha's People

Contributors

vds13 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.