Skip to content

TibebeJS/emoji-captcha-bot

Repository files navigation

Forks Stargazers Issues MIT License



🛡️ Emoji Captcha Bot for Telegram

Protect telegram groups from automated bots (spams, scams, adults, etc..)

Report Bug · Request Feature



Motivation

With Telegram increasingly getting popular and popular social media option in recent years, it has become a target for s(p/c)ammers. Many groups and their members are bombarded by spam and unsolicited messages on daily basis, mostly attributed to the lack of built-in protections systems in place.

This project intends to mitigate these issues by forcing every new member to go through a captcha verification process thus making it harder for automated accounts/userbots to roam free in these groups.

Getting Started

Git clone the repo:

git clone https://github.com/TibebeJS/emoji-captcha-bot.git

Change directory into the newly created repository ("emoji-captcha-bot")

cd emoji-captcha-bot.git

Install dependencies

npm i

Open up config/development/general.json5 file and provide botToken and challenge

{
  botToken: "123456:bot token", // REPLACE with your token - from @BotFather
  challenge: "text", // options: ['text-emoji', 'audio', 'image']
}

Then edit your challenge specific config file

E.g. if we choose 'text-emoji' as our challenge, then the config file would be config/development/text-emoji-captcha.json5

Example ("text-emoji-captcha.json5" file)

{
  challengeEmojisCount: 5, // how many emojis to present in the challenge
  answerEmojisColumns: 3, // number of columns in the answer's keypad
  answerEmojisRows: 3, // number of rows in the answer's keypad
  emojiSeparator: "-", // what's in between consecutive emojis
  numberOfAttempts: 3, // number of attempts before restriction
  timeout: 3000, // timeout before a challenge expires in milliseconds
  emojiBlacklist: [ "🖕", "🍆", "🍑" ], // dont show these emojis
  showCountryFlags: true, // show/hide country emojis
}

After successful configuration, run the project:

npm start

How it works

  • Whenever a new member joins a group they will automatically be muted/restricted by the bot.
  • Bot then sends a message which contains emojis (presented as text).
  • User is prompted with emoji buttons to click on.
  • if user successfully manages to select all the emojis that are present in the challenge, his/her restrictions will be lifted automatically by the bot.
  • if the user runs out of attempts left before completing the challenge, he/she will remain restricted.

Note:

make sure to add the bot with "delete messages" and "ban users" permissions.

Example:

Sample screenshot

If everything goes well, here is how it looks like when a new member joins the group.

Sample Challenge: (type: text-emoji-challenge)

Sample Timeout Screenshot

If text-emoji challenge has timed out:

Sample Timeout Screenshot

Features:

  • Text emojis challenge
  • Attempts counter
  • Add JSON configurations
  • Restrict when a member joins
  • Unrestrict after challenge
  • Scrambled Image challenge (instead of just text)
  • Audio challenge
  • Timeouts

More details can be found over: Project canban

Contribution:

Pick a task from Project canban, Assign yourself/get assigned, Fork, code and send a PR.