Skip to content

LynkrApp/Lux

Repository files navigation

Lux Discord Bot

A powerful Discord moderation bot built with TypeScript and Discord.js v14.

Features

🛡️ Moderation

  • User Management: Ban, kick, mute, timeout, warn users
  • Channel Management: Lockdown and unlock channels
  • Message Management: Bulk message purging
  • Infraction System: Add, remove, and track user infractions
  • Automated Moderation: Invite link detection and removal
  • Punishment Tracking: Comprehensive modlog system with persistent storage

⚙️ Configuration

  • Guild-specific Settings: Customizable per-server configuration
  • Role Management: Configurable moderation and muted roles
  • Channel Settings: Set moderation log channels and restricted channels
  • Flexible Commands: Support for both slash commands and text commands

📊 Information Commands

  • User Information: Detailed user profiles and statistics
  • Avatar Display: High-quality avatar viewing
  • Server Statistics: Ping and performance monitoring
  • Help System: Interactive command documentation

🔧 Advanced Features

  • Database Integration: PostgreSQL with Sequelize ORM
  • Event Logging: Comprehensive server activity tracking
  • Task Scheduling: Automated cleanup and maintenance
  • Error Handling: Robust error reporting and recovery

Installation

Prerequisites

  • Node.js 18+ or Bun
  • PostgreSQL database
  • Discord bot token with appropriate permissions

Package Manager Support

This bot supports multiple package managers:

# Using npm
npm install
npm run build
npm run dev

# Using yarn
yarn install
yarn build
yarn dev

# Using bun (recommended)
bun install
bun run build
bun run dev

Setup

  1. Clone the repository

    git clone <repository-url>
    cd lux
  2. Install dependencies

    bun install
  3. Configure environment variables

    cp .env.example .env

    Edit .env with your configuration:

    TOKEN=your_discord_bot_token
    CLIENT_ID=your_discord_client_id
    CLIENT_SECRET=your_discord_client_secret
    DATABASE_URL=postgresql://user:password@host:port/database
    DATABASE_URL_DEV=postgresql://user:password@host:port/database_dev
  4. Set up Discord bot permissions

    Required intents in Discord Developer Portal:

    • GUILD_MEMBERS
    • MESSAGE_CONTENT
    • GUILDS
    • GUILD_MESSAGES
    • GUILD_MESSAGE_REACTIONS
  5. Build and run

    bun run build
    bun run dev    # Development mode
    bun start      # Production mode

Commands

Moderation Commands

  • /ban <user> [duration] [reason] - Ban a user
  • /kick <user> [reason] - Kick a user
  • /mute <user> [duration] [reason] - Mute a user
  • /timeout <user> <duration> [reason] - Timeout a user
  • /warn <user> [reason] - Warn a user
  • /unban <user> [reason] - Unban a user
  • /unmute <user> [reason] - Unmute a user
  • /untimeout <user> [reason] - Remove timeout
  • /lockdown [channel] [reason] - Lock channel(s)
  • /unlock [channel] [reason] - Unlock channel(s)
  • /purge <amount> [user] - Delete messages
  • /modlogs <user> - View user's moderation history

Configuration Commands

  • /config set <key> <value> - Set configuration option
  • /config show <key> - Show configuration value
  • /config clear <key> - Clear configuration option
  • /config add <key> <value> - Add to array configuration
  • /config remove <key> <value> - Remove from array configuration

Information Commands

  • /ping - Check bot latency
  • /help [command] - Show help information
  • /user [user] - Display user information
  • /avatar [user] - Show user's avatar

Configuration Options

The bot supports extensive per-guild configuration:

  • moderationLogChannel - Channel for moderation logs
  • commandChannels - Channels where commands are allowed
  • joinRoles - Roles given to new members
  • mutedRole - Role applied when users are muted
  • lockdownChannels - Channels affected by lockdown commands

Database Schema

The bot uses PostgreSQL with the following main tables:

  • GuildConfigs - Server-specific configuration
  • Punishments - Moderation action records

Development

Project Structure

src/
├── bot.ts              # Main bot entry point
├── commands/           # Command implementations
│   ├── config/        # Configuration commands
│   ├── info/          # Information commands
│   └── moderation/    # Moderation commands
├── lib/               # Core library code
│   ├── constants.ts   # Bot constants and enums
│   ├── models/        # Database models
│   ├── structs/       # Core structures (Client, Handlers)
│   └── types.ts       # TypeScript type definitions
├── listeners/         # Event listeners
├── tasks/             # Scheduled tasks
└── util/              # Utility functions

Scripts

  • bun run build - Compile TypeScript
  • bun run dev - Run in development mode
  • bun start - Run in production mode
  • bun run lint - Check code style
  • bun run format - Format code
  • bun test - Run tests

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run bun run format and bun run lint
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Support

For support and questions:


Built with ❤️ using TypeScript and Discord.js

About

✨ The Light Sprite Mascot of Lynkr

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages