A feature-rich Discord bot built with TypeScript, discord.js v14, and Bun runtime. Packed with moderation tools, leveling systems, utility commands, and comprehensive logging capabilities.
- Auto-Moderation - Spam detection, profanity filter, link filtering, caps detection, mass mentions, Discord invite blocking
- Moderation Commands - Kick, ban, tempban, softban, unban, mute, unmute, warn, clear messages
- Mass Operations - Mass role assignment/removal with filters
- Lockdown - Temporarily lock channels
- Voice Moderation - Disconnect, move, mute, deafen users in voice channels
- Progressive Punishment - Automatic escalation for repeat offenders
- Nickname Management - Lock/unlock nicknames to prevent changes
- XP System - Gain XP from messages with customizable cooldowns
- Level Roles - Auto-assign roles when users reach specific levels
- Leaderboards - Track top members by XP and level
- Rank Cards - View your current rank and progress
- Ticket System - Support ticket creation with transcript support
- Giveaways - Create, manage, reroll, and end giveaways
- Polls - Create polls with up to 10 options
- Reaction Roles - Self-assignable roles via reactions
- Custom Tags - Create and manage server-specific tags
- Reminders - Set reminders (1 min - 7 days)
- AFK System - Set AFK status with auto-responses
- Embed Builder - Create custom embeds
- Say Command - Make the bot send messages
- Snipe - View recently deleted messages
- Starboard - Highlight popular messages with reactions
- Server Info - Detailed server statistics
- User Info - View user profiles and join dates
- Bot Info - Bot statistics and uptime
- Avatar - View and download user avatars
- 8ball - Ask the magic 8ball
- Coin Flip - Flip a coin
- Dice Roll - Roll dice with custom sides
- Choose - Pick random option from choices
- Per-Guild Settings - Welcome/goodbye messages, log channels, XP settings
- Audit Logging - Track all moderation actions
- Event Logging - Member joins/leaves, role updates, message edits/deletes, bans/unbans
- Custom Rules - Set and display server rules
- Web Dashboard - Optional browser-based management interface (see DASHBOARD.md)
- Runtime: Bun - Fast JavaScript runtime
- Language: TypeScript 5.x
- Framework: discord.js v14
- Database: SQLite (bun:sqlite)
- Bun installed (v1.0+)
- Discord bot token from Discord Developer Portal
- Basic understanding of Discord bot setup
- Clone the repository:
git clone https://github.com/d0mkaaa/OSBot.git
cd OSBot- Install dependencies:
bun install- Create environment file:
cp .env.example .env- Configure your
.envfile:
DISCORD_TOKEN=your_bot_token_here
CLIENT_ID=your_application_client_id- Deploy slash commands:
bun run deploy- Start the bot:
bun run devFor detailed setup instructions, see SETUP.md.
For a complete list of commands with examples, see COMMANDS.md.
Moderation (Requires appropriate permissions)
/ban- Ban a user/kick- Kick a user/warn- Warn a user/mute- Timeout a user/unmute- Remove timeout/clear- Bulk delete messages/automod- Configure auto-moderation/lockdown- Lock/unlock channels/massrole- Mass role operations/voice- Voice moderation
Utility
/ticket- Ticket system management/giveaway- Giveaway management/poll- Create polls/remind- Set reminders/afk- Set AFK status/embed- Create embeds/say- Send messages as bot/snipe- View deleted messages
Configuration (Requires Manage Guild)
/config- Configure bot settings/levelroles- Setup level roles/reactionrole- Setup reaction roles/tag- Manage custom tags/rules- Manage server rules
Information
/help- Show all commands/ping- Check bot latency/serverinfo- Server information/userinfo- User information/botinfo- Bot statistics/rank- View your rank/leaderboard- XP leaderboard/avatar- View avatars
Fun
/8ball- Ask the magic 8ball/coinflip- Flip a coin/roll- Roll dice/choose- Pick random option
For detailed configuration guide, see CONFIGURATION.md.
- Set Log Channels - Configure where events are logged:
/config log_channel #logs
/config audit_log_channel #mod-logs
- Configure Auto-Moderation:
/automod spam enabled:true threshold:5 interval:5
/automod profanity enabled:true preset:moderate
/automod action type:warn
- Set Welcome Messages:
/config welcome_message Welcome {user} to {server}!
/config welcome_channel #welcome
- Configure XP System:
/config xp_enabled enabled:true
/config xp_cooldown seconds:60
/levelroles add level:10 role:@Active Member
For full functionality, the bot needs these Discord permissions:
Essential Permissions:
Manage Roles- Auto-roles, level roles, reaction rolesManage Messages- Auto-moderation, message deletion, snipeKick Members- Kick command and automod actionsBan Members- Ban commandsModerate Members- Timeout/mute commandsManage Channels- Ticket system, lockdownManage Nicknames- Nickname managementSend Messages- All bot responsesEmbed Links- Rich embedsAdd Reactions- Polls, giveaways, reaction rolesRead Message History- Message moderation, snipe
Recommended Invite Link:
https://discord.com/api/oauth2/authorize?client_id=YOUR_CLIENT_ID&permissions=1099780063318&scope=bot%20applications.commands
Replace YOUR_CLIENT_ID with your bot's client ID.
Important Notes:
- The bot's role must be positioned higher than roles it needs to manage
- The bot cannot moderate users with roles higher than its highest role
- Some features require specific channel permissions (e.g., ticket system needs channel creation)
OSBot/
├── src/
│ ├── client/ # Discord client wrapper
│ ├── commands/ # Slash commands organized by category
│ │ ├── configuration/ # Config commands (config, levelroles, rules, tag)
│ │ ├── fun/ # Fun commands (8ball, coinflip, choose, roll)
│ │ ├── information/ # Info commands (help, ping, serverinfo, userinfo, etc.)
│ │ ├── moderation/ # Mod commands (ban, kick, warn, automod, etc.)
│ │ └── utility/ # Utility commands (ticket, giveaway, poll, etc.)
│ ├── config/ # Bot configuration
│ ├── database/ # Database manager and schema
│ ├── events/ # Discord event handlers
│ ├── handlers/ # Command and event loaders
│ ├── types/ # TypeScript type definitions
│ └── utils/ # Utility functions (logger, audit logger, etc.)
├── data/ # SQLite database storage
├── .env # Environment variables (create from .env.example)
├── package.json # Project metadata and scripts
└── tsconfig.json # TypeScript configuration
# Development mode with hot reload
bun run dev
# Build for production
bun run build
# Run production build
bun run start
# Deploy slash commands
bun run deployThe bot uses SQLite with the following tables:
guilds- Guild-specific settingsusers- User data and XPwarnings- Warning recordsaudit_logs- Moderation action logstickets- Support ticket datareaction_roles- Reaction role mappingstags- Custom server tagsreminders- Scheduled remindersafk_users- AFK status trackinggiveaways- Giveaway datalocked_nicknames- Locked nickname tracking
Database is automatically created on first run using schema.sql.
- Input Sanitization - All user inputs are validated
- SQL Injection Prevention - Prepared statements used throughout
- Rate Limiting - 3-second cooldown per command per user
- Permission System - Role hierarchy respected
- Auto-Moderation - Configurable content filtering
- Audit Logging - All moderation actions tracked
- Environment Variables - Sensitive data secured
The bot provides comprehensive logging:
Configure with /config log_channel:
- Member joins/leaves
- Message edits/deletes
- Role updates
- Channel updates
- Guild updates
- Bans/unbans
Configure with /config audit_log_channel:
- All moderation actions
- Configuration changes
- Auto-moderation actions
- Custom command usage
- Color-coded console output
- Timestamped entries
- Error tracking
- Command usage monitoring
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Run
bun run deployto register slash commands - Ensure bot has
applications.commandsscope - Check bot permissions in server settings
- Verify
DISCORD_TOKENin.env - Check bot is online in Discord
- Review console logs for errors
- Ensure bot has necessary permissions
- Delete
data/bot.dband restart (will reset all data) - Check file permissions on
data/directory - Verify Bun SQLite support
- Ensure bot role is high enough in hierarchy
- Check channel-specific permission overrides
- Verify bot has required permissions
For more help, check the console logs or create an issue.
This project is licensed under the MIT License - see the LICENSE file for details.
Created by d0mkaaa