Thanks for your interest in contributing to PlexBot! This guide covers how to get started, the development workflow, and project conventions.
- .NET 9 SDK
- Docker & Docker Compose (for running Lavalink)
- A Discord bot token (Developer Portal)
- A Plex server with a music library and an authentication token
-
Clone the repo
git clone https://github.com/kalebbroo/PlexBot.git cd PlexBot -
Configure secrets — Copy
RenameMe.env.txtto.envand fill in your credentials:cp RenameMe.env.txt .env
-
Configure app settings (optional) —
config.fdsis auto-created from the template if missing. To customize, copy and edit it:cp RenameMe.config.fds config.fds
Set
bot.environment: Developmentinconfig.fdsfor instant guild-scoped slash command updates. -
Start Lavalink — The bot needs a running Lavalink instance. The easiest way is Docker:
cd Install/Docker docker-compose up -d lavalinkThen set
LAVALINK_HOST=localhostin your.env(instead of the defaultLavalinkDocker service name). -
Build and run
dotnet build dotnet run
PlexBot/
├── Core/ # Core bot logic
│ ├── Discord/ # Discord interaction layer
│ │ ├── Commands/ # Slash command modules
│ │ ├── Autocomplete/ # Autocomplete handlers
│ │ └── Embeds/ # CV2 builders, buttons, visual player
│ ├── Events/ # Event bus system
│ ├── Extensions/ # Extension base class and manager
│ ├── Models/ # Data models (Track, Album, Playlist, etc.)
│ └── Services/ # Music services, providers, Lavalink
├── Extensions/ # Extension source directories (built at startup)
├── Docs/ # All documentation
├── Images/ # Player assets, icons, progress bar emoji
├── Install/ # Docker and install scripts
├── Main/ # Entry point, DI registration, global usings
└── Utils/ # Config, logging, HTTP utilities
| File | Purpose |
|---|---|
Main/ServiceRegistration.cs |
DI container setup |
Core/Discord/Embeds/ComponentV2Builder.cs |
Static factory for Components V2 layouts |
Core/Discord/Embeds/DiscordButtonBuilder.cs |
Flag-based button registration system |
Core/Discord/Embeds/VisualPlayer.cs |
Player UI rendering (modern image + classic embed) |
Core/Services/Music/PlexMusicService.cs |
Plex API integration with caching |
Core/Services/Music/MusicProviderRegistry.cs |
Routes searches to registered providers |
Core/Services/LavaLink/PlayerService.cs |
Audio playback via Lavalink4NET |
Core/Extensions/ExtensionManager.cs |
Discovers, builds, and loads extensions |
Utils/BotConfig.cs |
Reads config.fds settings |
Utils/EnvConfig.cs |
Reads .env secrets |
main— stable release branch- Feature branches — branch off
main, use descriptive names (e.g.add-soundcloud-provider,fix-queue-shuffle)
- Create a branch from
main - Make your changes
- Test locally with a real Discord bot and Plex server
- Open a pull request against
main
- C# 12 with primary constructors — use them for DI injection
- Nullable reference types enabled — avoid
nullwhere possible - Use the
Logsutility class for logging (notConsole.WriteLineorILogger) - Follow existing patterns: if similar code exists, match its style
- No unnecessary comments — code should be self-explanatory
All Discord messages use the Components V2 system. Follow these patterns:
- Use
ComponentV2Builderstatic methods for status messages (Error,Info,Success,Warning) - Always set
MessageFlags.ComponentsV2when usingModifyAsync - When modifying a message: set
msg.Components,msg.Embed = null, andmsg.Flags = MessageFlags.ComponentsV2
- Secrets (tokens, passwords, URLs) go in
.env— never in code orconfig.fds - App settings (UI, behavior, logging) go in
config.fds - Never commit
.envfiles
PlexBot has a plugin system for adding features without modifying the core. If your contribution is a self-contained feature (new music source, new command group, etc.), consider building it as an extension instead of modifying the core.
See Creating Extensions for the full guide.
- Keep PRs focused — one feature or fix per PR
- Write a clear description of what changed and why
- Include steps to test the changes
- If your PR adds a new command or config option, update the relevant docs in
Docs/
Use the Bug Report issue template. Include:
- Steps to reproduce
- Expected vs actual behavior
- Bot logs (
docker-compose logs plexbotor checklogs/) - Your environment (OS, Docker version, .NET version)
Use the Feature Request issue template. Describe the use case and why it would be valuable.
- Discord Server — for questions and discussion
- GitHub Issues — for bugs and feature requests
By contributing, you agree that your contributions will be licensed under the MIT License.