Skip to content

πŸ€– Complete Discord bot template with CAPTCHA, tickets, moderation & anti-spam. Ready-to-use TypeScript starter with modern Discord.js v14 architecture ⚑

License

Notifications You must be signed in to change notification settings

ThisDudeBoy/discord-bot-template-advanced

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Discord Bot Template Advanced

A comprehensive Discord bot template with CAPTCHA verification, advanced ticket system, and anti-advertising protection. Perfect starter for your Discord server!

Created by AlexM πŸš€

✨ Features

πŸ” CAPTCHA Verification System

  • Visual CAPTCHA generation for new members
  • Automatic role assignment after successful verification
  • Smart cleanup system that removes CAPTCHA messages when users leave
  • Configurable timeout (10 minutes) with automatic kick
  • 3-attempt limit with kick on failure

πŸ›‘οΈ Anti-Advertising Protection

  • Real-time detection of Discord invite links
  • Message editing protection - catches ads added via message edits
  • Whitelist system for allowed server invites
  • Automatic timeout for violators (5 minutes)
  • Smart regex patterns for comprehensive detection

🎫 Advanced Ticket System

  • 6 ticket categories: Technical Support, General Help, Suggestions, Reports, Partnerships, Other
  • Transcript generation with multiple fallback services (paste.ee, dpaste)
  • Direct message notifications with transcript links when tickets close
  • Professional embed interface with buttons and modals
  • Staff role pinging for immediate attention

πŸŽ‰ Welcome System

  • 20+ funny welcome messages with random selection
  • Rich embeds with user avatar, join date, and member count
  • User mention integration for personal touch
  • Separate welcome channel from CAPTCHA verification
  • Automatic member counting and statistics

βš™οΈ Bot Management

  • Dynamic command/event loading from filesystem
  • Professional /botinfo command with detailed statistics
  • Comprehensive error handling and logging
  • TypeScript-first development with full type safety

πŸ”¨ Moderation Commands

  • /ban - Ban members with reason logging
  • /kick - Kick members with reason logging
  • /help - Dynamic help system with all commands
  • /ping - Latency testing
  • /botinfo - Detailed bot statistics and information

πŸ› οΈ Installation

Prerequisites

Setup Steps

  1. Clone the repository

    git clone https://github.com/ThisDudeBoy/discord-bot-template-advanced.git
    cd discord-bot-template-advanced
  2. Install dependencies

    npm install
  3. Environment Configuration

    Create a .env file with your Discord bot credentials:

    # Discord Configuration
    DISCORD_TOKEN=your_bot_token_here
    CLIENT_ID=your_application_id_here
    GUILD_ID=your_guild_id_for_testing
    
    # Channel Configuration
    WELCOME_CHANNEL_ID=your_welcome_channel_id
    CAPTCHA_CHANNEL_ID=your_captcha_channel_id
    VERIFIED_ROLE_ID=your_verified_role_id
    TICKET_CATEGORY_ID=your_ticket_category_id
    LOG_CHANNEL_ID=your_log_channel_id
    STAFF_ROLE_ID=your_staff_role_id
    
    # Environment
    NODE_ENV=production
  4. Deploy slash commands

    npm run deploy
  5. Start the bot

    # Production
    npm run start:dev
    
    # Development with auto-reload
    npm run dev

πŸ“ Project Structure

discord-bot-template-advanced/
β”œβ”€β”€ πŸ“‚ src/
β”‚   β”œβ”€β”€ πŸ“‚ commands/           # Slash commands (auto-loaded)
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ general/        # General commands
β”‚   β”‚   β”‚   β”œβ”€β”€ help.ts        # Dynamic help system
β”‚   β”‚   β”‚   β”œβ”€β”€ ping.ts        # Latency testing
β”‚   β”‚   β”‚   └── botinfo.ts     # Bot statistics
β”‚   β”‚   └── πŸ“‚ moderation/     # Moderation commands
β”‚   β”‚       β”œβ”€β”€ ban.ts         # Ban command with logging
β”‚   β”‚       └── kick.ts        # Kick command with logging
β”‚   β”œβ”€β”€ πŸ“‚ events/             # Discord events (auto-loaded)
β”‚   β”‚   β”œβ”€β”€ ready.ts           # Bot ready event
β”‚   β”‚   β”œβ”€β”€ guildMemberAdd.ts  # CAPTCHA system
β”‚   β”‚   β”œβ”€β”€ guildMemberRemove.ts # CAPTCHA cleanup
β”‚   β”‚   β”œβ”€β”€ interactionCreate.ts # Commands, buttons, modals
β”‚   β”‚   β”œβ”€β”€ messageCreate.ts   # Anti-advertising (new messages)
β”‚   β”‚   └── messageUpdate.ts   # Anti-advertising (message edits)
β”‚   β”œβ”€β”€ πŸ“‚ utils/              # Utility functions
β”‚   β”‚   β”œβ”€β”€ captcha.ts         # CAPTCHA generation with Canvas
β”‚   β”‚   β”œβ”€β”€ captchaManager.ts  # Session management
β”‚   β”‚   β”œβ”€β”€ config.ts          # Bot configuration
β”‚   β”‚   └── embeds.ts          # Reusable embed builders
β”‚   β”œβ”€β”€ πŸ“‚ types/              # TypeScript definitions
β”‚   β”‚   └── index.ts           # Interface definitions
β”‚   └── index.ts               # Main bot entry point
β”œβ”€β”€ πŸ“„ package.json            # Dependencies and scripts
β”œβ”€β”€ πŸ“„ tsconfig.json          # TypeScript configuration
└── πŸ“„ README.md              # This file

🎨 Technologies Used

  • TypeScript - Type-safe JavaScript development
  • Discord.js v14 - Modern Discord API wrapper
  • Node.js - JavaScript runtime environment
  • Canvas - CAPTCHA image generation
  • Axios - HTTP client for transcript uploads
  • Chalk - Terminal styling for logs

βš™οΈ Configuration Guide

Channel Setup

Replace the IDs in your .env file with your server's specific channel IDs:

# Welcome messages channel (where funny welcome messages are sent)
WELCOME_CHANNEL_ID=your_welcome_channel_id

# CAPTCHA verification channel (where new members get CAPTCHA)
CAPTCHA_CHANNEL_ID=your_captcha_channel_id

# Role given after successful CAPTCHA completion
VERIFIED_ROLE_ID=your_verified_role_id

# Ticket category (where ticket channels are created)
TICKET_CATEGORY_ID=your_ticket_category_id

# Staff role (gets pinged for new tickets)
STAFF_ROLE_ID=your_staff_role_id

Anti-Advertising Whitelist

Edit src/events/messageCreate.ts to add allowed Discord servers:

const allowedInvites = [
    'discord.gg/your-server-invite', // Add your server invites here
];

πŸš€ Deployment

Development

npm run start:dev  # Run with tsx (TypeScript execution)
npm run dev        # Run with auto-reload on file changes

Production

npm run build      # Compile TypeScript to JavaScript
npm start          # Run compiled JavaScript

🀝 Contributing

Want to contribute? Awesome! Here's how:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Development Guidelines

  • Use TypeScript for all new code
  • Follow existing code style and patterns
  • Add JSDoc comments for functions
  • Test thoroughly before submitting PRs

πŸ“ Changelog

v1.0.0 (Current)

  • βœ… CAPTCHA verification system with visual challenges
  • βœ… Advanced ticket system with 6 categories and transcripts
  • βœ… Anti-advertising protection with regex detection
  • βœ… Dynamic command/event loading from filesystem
  • βœ… Professional embed interfaces throughout
  • βœ… TypeScript-first development with full type safety
  • βœ… Comprehensive error handling and logging

πŸ› Known Issues

Currently no known issues! πŸŽ‰

If you find any bugs, please create an issue.

πŸ’¬ Support

Need help? Here are your options:

  1. πŸ“– Read the documentation (this README)
  2. πŸ” Check existing issues on GitHub
  3. πŸ†• Create a new issue if needed
  4. πŸ’¬ Join our Discord for live support: https://discord.gg/q6T3bX2ZFG

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

⚠️ Disclaimer

This bot is provided "as is" without warranty. Use at your own risk and ensure compliance with Discord's Terms of Service.

πŸ™ Acknowledgments

  • Discord.js Team for the amazing library
  • Canvas contributors for CAPTCHA generation capabilities
  • TypeScript Team for type safety
  • The Discord Bot community for inspiration and best practices

Made with ❀️ by AlexM

⭐ Star this repo if it helped you! ⭐

About

πŸ€– Complete Discord bot template with CAPTCHA, tickets, moderation & anti-spam. Ready-to-use TypeScript starter with modern Discord.js v14 architecture ⚑

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •