by we

CaptchaGuard Bot

Test this app for free
17
import os
import asyncio
import discord
from discord.ext import commands
import random
import string

def generate_captcha():
    return ''.join(random.choices(string.ascii_uppercase + string.digits, k=6))

def start_bot(token):
    intents = discord.Intents.default()
    intents.members = True
    intents.message_content = True
    intents.guilds = True
    bot = commands.Bot(command_prefix='!', intents=intents)

    @bot.event
    async def on_ready():
        print(f'Bot is ready. Logged in as {bot.user}')
        for guild in bot.guilds:
            for member in guild.members:
                if not member.bot:
                    captcha = generate_captcha()
Get full code

Created: | Last Updated:

Bot that provides captcha challenges to new members upon joining a guild.

Here's a step-by-step guide on how to use the CaptchaGuard Bot template:

Introduction

The CaptchaGuard Bot is a Discord bot that provides captcha challenges to new members upon joining a guild. This bot helps verify users and adds a layer of security to your Discord server.

Getting Started

  1. Click "Start with this Template" to begin using the CaptchaGuard Bot template in Lazy.

  2. Set up the required environment secret:

  3. In the Lazy Builder interface, navigate to the Environment Secrets tab.
  4. Add a new secret with the key BOT_TOKEN.
  5. To get your Bot Token:
    • Go to the Discord Developer Portal.
    • Create a new application or select an existing one.
    • Navigate to the "Bot" section.
    • Click "Add Bot" if you haven't created a bot for this application yet.
    • Under the "Token" section, click "Copy" to copy your bot token.
  6. Paste the copied token as the value for the BOT_TOKEN secret in Lazy.

Test the Bot

  1. Click the "Test" button in the Lazy Builder interface to start the deployment process.

Using the Bot

  1. Once the bot is running, it will automatically send captcha challenges to new members who join your Discord server.

  2. The bot will perform the following actions:

  3. Send a direct message to new members with a captcha challenge.
  4. Ask the user to respond with the captcha to verify themselves.
  5. Provide an invite link for the bot (in case it's not already in the server).

  6. When a user responds to the captcha in a direct message:

  7. The bot will thank them for responding.
  8. If a "Verified" role exists in the server, the bot will assign this role to the user.
  9. The user will receive a confirmation message that they've been verified.

Integrating the Bot

  1. To add the bot to your Discord server:
  2. Use the invite link provided in the bot's direct message to new members.
  3. Alternatively, you can create an invite link in the Discord Developer Portal:

    • Go to your application in the Discord Developer Portal.
    • Navigate to the "OAuth2" section.
    • In the "Scopes" section, select "bot".
    • In the "Bot Permissions" section, select the necessary permissions (at minimum: "Send Messages", "Read Messages/View Channels", "Manage Roles").
    • Copy the generated URL and use it to invite the bot to your server.
  4. Create a "Verified" role in your Discord server:

  5. In your Discord server settings, go to the "Roles" section.
  6. Click the "+" button to create a new role.
  7. Name the role "Verified".
  8. Set the appropriate permissions for verified users.

  9. Ensure the bot's role is higher in the role hierarchy than the "Verified" role to allow it to assign the role to users.

By following these steps, you'll have successfully set up and integrated the CaptchaGuard Bot into your Discord server, providing an additional layer of security through captcha verification for new members.

Technologies

Similar templates