Package Exports
- telegram-captcha
- telegram-captcha/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (telegram-captcha) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
π‘οΈtelegram-captchaπ‘οΈ
π 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_319 = 1;
const bot = new TelegramBot(TOKEN, {polling: true});
const captcha = new GroupCaptcha(bot);
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_319 = 1;
const bot = new TelegramBot(TOKEN, {polling: true});
const captcha = new GroupCaptchaRTJ(bot);
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)
}βοΈ Todo:
- Captcha for an open group
- Captcha for a group with requests to join
- Option
"size" - Option
"ban time" - Option
"time to enter captcha" - Support
Telegraf/grammY/telebot - reCaptcha
- Other types of captcha
License
The MIT License (MIT)
Copyright Β© 2023 Dmitry Vyazin