Skip to content

ZoniBoy00/VoidSentry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”จ VoidSentry v2.0

VoidSentry Banner

A high-performance Discord security bot designed to catch and remove self-bots and malicious users who ignore server warnings. The bot monitors specific "Trap" channels and instantly bans anyone who sends a message there.

๐Ÿš€ Features

  • Instant Detection โ€” Real-time monitoring of multiple restricted channels.
  • Auto-Ban โ€” Immediately bans violators with zero tolerance.
  • 24h Message Purge โ€” Automatically deletes all messages the banned user sent in the last 24 hours across the server.
  • DM Notification โ€” Sends a notification to the user before banning (best-effort, fails silently if DMs disabled).
  • MySQL Database โ€” Persistent ban history storage with search and statistics.
  • Detailed Ban Logs โ€” Rich embed logs with:
    • User avatar, tag, ID, and mention
    • Account creation date
    • Server join date
    • Display name and roles
    • Captured message content
    • Suspicious account age warning (< 7 days old)
  • Slash Commands:
    • /setup-trap โ€” Initialize trap channels
    • /status โ€” View bot uptime, statistics, and recent bans
    • /ban-info โ€” Look up ban information for a user by ID (Discord ban lookup)
    • /bans โ€” Ban history from database:
      • /bans recent [limit] โ€” Show recent bans
      • /bans search <user_id> โ€” Search bans by user ID
      • /bans stats โ€” Show database statistics
  • Structured Logging โ€” Colored console logger with timestamps (system, security, ban, detection, command)
  • Statistics Tracking โ€” In-memory tracking of bans, detections, and DM success rate
  • Branded Design โ€” Custom logo and professional embeds

๐Ÿ“ Project Structure

VoidSentry/
โ”œโ”€โ”€ assets/                        # Branding assets
โ”‚   โ”œโ”€โ”€ logo.png
โ”‚   โ”œโ”€โ”€ VoidSentryBanner.gif
โ”‚   โ””โ”€โ”€ VoidSentryLogo.gif
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”‚   โ””โ”€โ”€ index.js               # Environment config, MySQL settings
โ”‚   โ”œโ”€โ”€ commands/
โ”‚   โ”‚   โ”œโ”€โ”€ setupTrap.js            # /setup-trap
โ”‚   โ”‚   โ”œโ”€โ”€ status.js              # /status
โ”‚   โ”‚   โ”œโ”€โ”€ banInfo.js             # /ban-info (Discord ban lookup)
โ”‚   โ”‚   โ””โ”€โ”€ bans.js                # /bans (database history)
โ”‚   โ”œโ”€โ”€ embeds/
โ”‚   โ”‚   โ”œโ”€โ”€ warningEmbed.js        # Trap channel warning
โ”‚   โ”‚   โ”œโ”€โ”€ banLogEmbed.js         # Detailed ban log
โ”‚   โ”‚   โ””โ”€โ”€ banNotificationEmbed.js # DM notification
โ”‚   โ”œโ”€โ”€ events/
โ”‚   โ”‚   โ”œโ”€โ”€ ready.js               # Bot startup & database init
โ”‚   โ”‚   โ”œโ”€โ”€ interactionCreate.js   # Slash command router
โ”‚   โ”‚   โ””โ”€โ”€ messageCreate.js       # Core trap detection & ban logic
โ”‚   โ””โ”€โ”€ utils/
โ”‚       โ”œโ”€โ”€ db.js                   # MySQL database connection
โ”‚       โ”œโ”€โ”€ deploy.js              # Slash command deployment
โ”‚       โ”œโ”€โ”€ helpers.js             # Utility functions
โ”‚       โ”œโ”€โ”€ logger.js              # Colored console logger with timestamps
โ”‚       โ”œโ”€โ”€ permissions.js         # Permission checker
โ”‚       โ”œโ”€โ”€ stats.js               # In-memory statistics
โ”‚       โ””โ”€โ”€ constants.js           # Colors, paths, branding
โ”œโ”€โ”€ .env                           # Your secrets (not committed)
โ”œโ”€โ”€ .env.example                   # Example config template
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ index.js                       # Entry point
โ”œโ”€โ”€ package.json
โ””โ”€โ”€ README.md

๐Ÿ› ๏ธ Installation

  1. Requirement: Node.js v18.0 or higher.
  2. Database: Set up a MySQL database (see configuration below).
  3. Download: Clone or download this repository.
  4. Install Dependencies:
    npm install

โš™๏ธ Configuration (.env)

Copy .env.example to .env and fill in your credentials:

Discord Configuration

Key Description
DISCORD_TOKEN Your bot's secret token from the Developer Portal.
CLIENT_ID Your bot's Application ID.
OWNER_ID Your Discord User ID (for admin commands).
GUILD_ID Discord Server ID for development (guild commands).
BAN_CHANNEL_IDS IDs of "Trap" channels, separated by commas.
LOG_CHANNEL_ID Channel ID for ban log embeds.
STATUS_TEXT Bot status text (default: Watching for breaches...).
DELETE_MESSAGE_SECONDS Messages to delete on ban (default: 86400 = 24h).
BAN_REASON Custom ban reason.
NODE_ENV development for guild commands, production for global.

MySQL Database Configuration

Key Description Default
DB_HOST MySQL server hostname localhost
DB_PORT MySQL server port 3306
DB_USER MySQL username root
DB_PASSWORD MySQL password (empty)
DB_NAME Database name voidsentry

Note: The database and table will be created automatically on first run.

๐Ÿ•น๏ธ How to Use

  1. Create Database (optional - auto-created on first run):

    CREATE DATABASE voidsentry;
  2. Invite the Bot: Ensure the bot has Ban Members, Manage Messages, and View Channels permissions.

  3. Role Hierarchy: Move the bot's role to the very top of your Role list.

  4. Deploy Commands:

    # For development (faster, guild-specific)
    npm run deploy:guild
    
    # For production (global commands, ~1hr propagation)
    npm run deploy
  5. Launch:

    npm start
  6. Initialize: Go to each trap channel and use /setup-trap.

๐ŸŽฎ Commands

Command Description Permissions
/setup-trap Clears channel and posts trap warning Owner / Administrator
/status Bot uptime, stats, ping, recent bans Owner / Administrator
/ban-info Look up Discord ban by user ID Owner / Administrator
/bans recent [limit] Recent bans from database Owner / Administrator
/bans search <user_id> Search database by user ID Owner / Administrator
/bans stats Database statistics Owner / Administrator

๐Ÿ“‹ Ban Log Details

When a user is banned, the log embed includes:

Field Description
๐Ÿ‘ค User Tag, ID, and mention
๐Ÿ“… Account Created When the Discord account was created
๐Ÿ“ฅ Joined Server When the user joined your server
๐Ÿท๏ธ Display Name Server nickname or username
๐ŸŽญ Roles All roles the user had (up to 15)
โš ๏ธ Violation Reason Why the ban occurred
๐Ÿ“ Detected In Which trap channel triggered the ban
๐Ÿ• Action Taken At Exact timestamp of the ban
๐Ÿ’ฌ Message Content What the user wrote (truncated if long)
๐Ÿšฉ Suspicious Flag Warns if the account is less than 7 days old

๐Ÿ”ง Ban Process Flow

  1. ๐Ÿ” Detection โ€” Message detected in trap channel
  2. ๐Ÿ—‘๏ธ Cleanup โ€” Trigger message immediately deleted
  3. โœ… Validation โ€” Bot permissions and role hierarchy checked
  4. ๐Ÿ“จ DM Notification โ€” User notified via DM (best-effort)
  5. ๐Ÿ”จ Ban Execution โ€” User banned, 24h of messages purged
  6. ๐Ÿ’พ Database โ€” Ban record stored in MySQL
  7. ๐Ÿ“Š Stats โ€” Ban recorded in statistics tracker
  8. ๐Ÿ“ Logging โ€” Detailed embed sent to log channel

๐Ÿ“ Important Notes

  • Message Content Intent: Must be enabled in Discord Developer Portal โ†’ Bot โ†’ Privileged Intents.
  • Database: MySQL is required for ban history storage. Database auto-creates on first run.
  • No Appeals: The bot uses a "zero-tolerance" policy. Anyone typing in the trap channel is banned immediately.
  • 24h Purge: All messages from the banned user in the last 24 hours are automatically deleted.
  • DM Notification: Best-effort, fails silently if user has DMs disabled.

๐Ÿ”Œ Database Schema

The bans table is created automatically:

CREATE TABLE bans (
    id INT AUTO_INCREMENT PRIMARY KEY,
    user_id VARCHAR(20) NOT NULL,
    user_tag VARCHAR(100) NOT NULL,
    guild_id VARCHAR(20) NOT NULL,
    guild_name VARCHAR(100) NOT NULL,
    channel_id VARCHAR(20) NOT NULL,
    channel_name VARCHAR(100) NOT NULL,
    message_content TEXT,
    reason VARCHAR(500) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    INDEX idx_user_id (user_id),
    INDEX idx_guild_id (guild_id),
    INDEX idx_created_at (created_at)
);

Created for secure Discord community management.

About

๐Ÿ›ก๏ธ VoidSentry โ€“ High-performance Discord security bot designed to catch and remove malicious users using automated trap channels.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages