A powerful Discord moderation bot built with TypeScript and Discord.js v14.
- 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
- 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
- User Information: Detailed user profiles and statistics
- Avatar Display: High-quality avatar viewing
- Server Statistics: Ping and performance monitoring
- Help System: Interactive command documentation
- 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
- Node.js 18+ or Bun
- PostgreSQL database
- Discord bot token with appropriate permissions
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-
Clone the repository
git clone <repository-url> cd lux
-
Install dependencies
bun install
-
Configure environment variables
cp .env.example .env
Edit
.envwith 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
-
Set up Discord bot permissions
Required intents in Discord Developer Portal:
GUILD_MEMBERSMESSAGE_CONTENTGUILDSGUILD_MESSAGESGUILD_MESSAGE_REACTIONS
-
Build and run
bun run build bun run dev # Development mode bun start # Production mode
/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
/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
/ping- Check bot latency/help [command]- Show help information/user [user]- Display user information/avatar [user]- Show user's avatar
The bot supports extensive per-guild configuration:
moderationLogChannel- Channel for moderation logscommandChannels- Channels where commands are allowedjoinRoles- Roles given to new membersmutedRole- Role applied when users are mutedlockdownChannels- Channels affected by lockdown commands
The bot uses PostgreSQL with the following main tables:
GuildConfigs- Server-specific configurationPunishments- Moderation action records
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
bun run build- Compile TypeScriptbun run dev- Run in development modebun start- Run in production modebun run lint- Check code stylebun run format- Format codebun test- Run tests
- Fork the repository
- Create a feature branch
- Make your changes
- Run
bun run formatandbun run lint - Submit a pull request
MIT License - see LICENSE file for details.
For support and questions:
- Create an issue on GitHub
- Join our Discord Server
Built with ❤️ using TypeScript and Discord.js