amtixdev-captcha-verification

1.0.0-beta • Public • Published

amtixdev-captcha-verification

Discord server NPM version NPM downloads

AmtiXDev

Captcha Verification for Discord Bots

A simple npm package for generating and verifying captcha codes with numbers for Discord bots.

Installation

npm install captcha-verification

Usage

const Discord = require('discord.js');
const CaptchaVerifier = require('captcha-verification');

const client = new Discord.Client();
const captchaVerifier = new CaptchaVerifier(client);

client.on('message', (message) => {
  if (message.author.bot) return;

  // Example: Send captcha to the same channel when a certain command is sent
  if (message.content.toLowerCase() === '!sendcaptcha') {
    captchaVerifier.sendCaptchaMessage(message.channel);
  }

  // Example: Verify the user's input
  const userInput = message.content.trim();
  const isVerified = captchaVerifier.verifyCaptcha(userInput);

  if (isVerified) {
    message.reply('Captcha verified successfully!');
  }
});

client.login('YOUR_BOT_TOKEN');

Replace ('YOUR_BOT_TOKEN') with your Discord bot token.

Methods

'sendCaptchaMessage(channel)' Sends the generated captcha code to the specified channel.

Parameters:

channel (Discord.js Channel): The channel to send the captcha message. verifyCaptcha(userInput) Verifies if the provided user input matches the generated captcha code.

Parameters:

userInput (String): The user's input to be verified.

Returns:

true if the input is correct, false otherwise.

Package Sidebar

Install

npm i amtixdev-captcha-verification

Weekly Downloads

0

Version

1.0.0-beta

License

ISC

Unpacked Size

3.98 kB

Total Files

3

Last publish

Collaborators

  • amtixdev