Xeon
Executive
- Joined
- Oct 22, 2024
- Messages
- 21
- Reaction score
- 13
- Points
- 3
This is a repost of my own github repo available at:
[Log in or register to see link]
Gatekeeper Discord Bot
A Discord bot that provides CAPTCHA-based verification for new members across multiple servers. The bot uses MongoDB for data storage, Canvas for CAPTCHA image generation, and is built with Node.js and Discord.js.-----------------------------------------------------------------
Features
- CAPTCHA-based verification system to prevent bots and spam accounts.
- Configurable verification panel with custom messages and timer durations.
- Assign multiple roles upon successful verification.
- Supports multiple servers with individual configurations.
- Stores data in MongoDB for scalability and reliability.
- Logs verification events with user and server details.
- Automatically deletes temporary CAPTCHA images after use or expiration.
- Displays bot status as "Watching over x users" across all servers.
Prerequisites
Before installing the bot, ensure you have the following installed on your system:- [Log in or register to see link] (v16.9.0 or newer)
- [Log in or register to see link] (comes with Node.js)
- [Log in or register to see link] (local instance)
- [Log in or register to see link] (required for compiling native modules like Canvas on Windows)
Installation
Follow these steps to install and run the Gatekeeper Discord Bot:1. Clone the Repository
Bash:
git clone https://github.com/Avexiis/Gatekeeper.git
cd Gatekeeper
2. Install Dependencies
Bash:
npm install
3. Install Visual Studio Build Tools 2022 (Windows Only)
For Windows users, you need to install Visual Studio Build Tools to compile native modules like Canvas.- Download and install [Log in or register to see link].
- During installation, select the "Desktop development with C++" workload.
4. Set Up MongoDB
Ensure that MongoDB is installed and running on your local machine.- Start the MongoDB service:
- Windows:
Bash:net start MongoDB
- macOS/Linux:
Bash:sudo service mongod start
- Windows:
- The bot connects to MongoDB using the default connection string
Code:
mongodb://localhost:27017/discordbot
5. Configure the Bot
Insert your bot's token and client ID into the index.js and events/ready.js files.In index.js:
JavaScript:
// Replace with your bot's token and client ID
const token = 'YOUR_BOT_TOKEN'; // Replace 'YOUR_BOT_TOKEN' with your actual bot token
const clientId = 'YOUR_CLIENT_ID'; // Replace 'YOUR_CLIENT_ID' with your actual client ID
In events/ready.js:
JavaScript:
// Replace with your client ID
const clientId = 'YOUR_CLIENT_ID'; // Replace 'YOUR_CLIENT_ID' with your actual client ID
- Replace 'YOUR_BOT_TOKEN' with your actual Discord bot token.
- Replace 'YOUR_CLIENT_ID' with your bot's client ID.
6. Set Up Discord Bot Permissions and Intents
In the [Log in or register to see link]:- Navigate to your application.
- Go to the Bot section.
- Enable the Server Members Intent under Privileged Gateway Intents.
- Ensure your bot has the necessary permissions, such as Manage Roles, Send Messages, Embed Links, and Use Slash Commands.
Configuration
After installing and setting up the bot, you need to invite it to your Discord server and configure it:1. Invite the Bot to Your Server
Generate an OAuth2 URL in the Developer Portal with the appropriate scopes and permissions, and use it to invite the bot to your server.2. Configure the Bot in Your Server
Use the
Code:
/config
Code:
/config role1:@Verified panelmessage:"Please verify yourself to access the server." timer:3
- role1: (Required) The first role to assign upon successful verification.
- role2 to role5: (Optional) Additional roles to assign upon verification.
- panelmessage: The message displayed on the verification panel.
- timer: CAPTCHA expiration time in minutes.
Code:
/config role1:@Member role2:@Gamer role3:@Artist panelmessage:"Welcome! Please verify to join the community." timer:5
3. Send the Verification Panel
Use the
Code:
/sendverifypanel
Code:
/sendverifypanel channel:#verification
- channel: The channel where the verification panel will be sent.
Usage
The bot provides a CAPTCHA-based verification process for new members:- A user joins the server and sees the verification panel in the specified channel.
- The user clicks the "Verify" button.
- The bot sends an ephemeral message with a CAPTCHA image and two buttons: "Answer" and "New CAPTCHA".
- "Answer": Opens a modal where the user can enter the CAPTCHA text.
- "New CAPTCHA": Generates a new CAPTCHA image, deletes the old one, and resets the timer.
- The user enters the correct CAPTCHA text within the specified time limit.
- Upon successful verification, the bot assigns the configured role(s) to the user.
- The bot logs the verification event, including the user and server details.
- The bot updates its status to reflect the total number of users it's watching over.
Commands
/config
Configure the verification settings for your server.- Usage:
Code:/config role1:@Verified panelmessage:"Please verify yourself to access the server." timer:3
- Parameters:
-
Code:
- role1 (Required): The first role to assign upon verification. - role2 to role5 (Optional): Additional roles to assign upon verification. - panelmessage (Required): The message displayed on the verification panel. - timer (Required): CAPTCHA expiration time in minutes.
-
/sendverifypanel
Send the verification panel to a specified channel.- Usage:
Code:/sendverifypanel channel:#verification
- Parameters:
- channel: The channel where the verification panel will be sent.
Last edited: