57 lines
1.5 KiB
Markdown
57 lines
1.5 KiB
Markdown
# discord-music-bot
|
|
|
|
Discord music bot template written in Rust using `serenity` and `lavalink-rs`.
|
|
|
|
## Features
|
|
- Slash commands: `/ping`, `/join`, `/play`, `/leave`
|
|
- LavaLink integration for audio playback
|
|
- Modular command handler structure
|
|
|
|
## Prerequisites
|
|
- Rust (stable toolchain)
|
|
- A Discord application with bot token
|
|
- LavaLink server running (see [LavaLink](https://github.com/freyacodes/Lavalink))
|
|
|
|
## Setup
|
|
|
|
1. Copy `.env.example` to `.env` and fill in your credentials:
|
|
```
|
|
DISCORD_TOKEN=your_discord_bot_token
|
|
LAVALINK_HOST=127.0.0.1
|
|
LAVALINK_PORT=2333
|
|
LAVALINK_PASSWORD=your_lavalink_password
|
|
```
|
|
|
|
2. Build the project:
|
|
```sh
|
|
cargo build --release
|
|
```
|
|
|
|
3. Run the bot:
|
|
```sh
|
|
cargo run --release
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
- `src/main.rs` - Bot entry point, initializes Serenity and LavaLink clients
|
|
- `src/handler.rs` - Serenity event handlers (ready, interaction, voice updates)
|
|
- `src/lavalink_handler.rs` - LavaLink event handlers
|
|
- `src/state.rs` - TypeMap keys for shared state
|
|
- `src/utils.rs` - Utility functions (env management)
|
|
- `src/commands/` - Modular slash command definitions and handlers
|
|
|
|
## Commands
|
|
|
|
- `/ping` - Replies with "Pong!"
|
|
- `/join` - Bot joins your voice channel
|
|
- `/play url:<URL>` - Plays audio from the given URL
|
|
- `/leave` - Bot leaves the voice channel
|
|
|
|
## TODO
|
|
- Implement actual command logic in `src/commands/*.rs`
|
|
- Add error handling and command concurrency management
|
|
- Expand LavaLink event handlers
|
|
|
|
## License
|
|
MIT |