VŠB-TUO — School project · Programming in Rust (PvR)
A feature-rich Discord music bot written in Rust. Supports YouTube, Spotify, local audio files, and direct URLs. Includes a persistent queue, per-guild volume memory, loudness normalization, timed reminders, and various utility commands.
- YouTube (direct URL or text search)
- Spotify (URL — resolved to YouTube for playback)
- Local audio library stored on the bot host
- Discord attachment uploads (audio files)
- Arbitrary direct URLs
| Command | Description |
|---|---|
play <query|url> |
Play a track or playlist, append to queue |
playtop <query|url> |
Same, but insert at front of queue |
pause / resume |
Pause and resume the current track |
skip [amount] |
Skip current track (or N tracks) |
stop |
Stop playback and clear the active track |
playing |
Show the currently playing track |
volume [1-100] |
Set volume; append ! for overdrive (1–500) |
normalize [on|off] |
Toggle cross-track loudness normalization (EBU R128) |
silent [on|off] |
Suppress Now Playing announcements |
join / leave |
Summon or dismiss from voice channel |
| Command | Description |
|---|---|
queue |
Paginated queue (10 tracks/page) with navigation |
clear |
Remove all tracks from the queue |
remove <index> |
Remove a specific track by 1-based index |
shuffle |
Shuffle the current queue |
history |
Last 10 played tracks with replay buttons |
| Command | Description |
|---|---|
local download <url> [name] |
Download audio from URL into library |
local upload [name] |
Save a Discord attachment into library |
local list |
List all saved tracks |
local play [name] |
Play a saved track (with autocomplete) |
local rename <track> <name> |
Rename a saved track |
local remove <track> |
Delete a saved track |
| Command | Description |
|---|---|
notify me <when> <msg> |
Schedule a reminder for yourself |
notify you <user> <when> <msg> |
Schedule a reminder for another user |
notify list |
List your pending reminders |
notify remove <id> |
Cancel a pending reminder |
| Command | Description |
|---|---|
wakeup <user> [count] |
Drag a user between voice channels to get attention |
rename <user> [name] |
Set a member's nickname |
uwu <text> |
Uwuify text |
help [command] |
Show command list or per-command help |
All commands are available as both prefix commands (default !) and slash commands (/).
- Auto-leave when alone in channel
- Per-guild volume persistence (SQLite)
- Cross-track loudness normalization (opt-in, EBU R128 via ffmpeg)
- Slash + prefix parity
- Graceful SIGINT/SIGTERM shutdown
- Structured logging via
tracing
- Rust stable toolchain — rustup.rs
yt-dlpin system PATHffmpegin system PATH- CMake (required by
audiopus_sys) - Discord bot token — discord.com/developers
- YouTube Data API v3 key — Google Cloud Console
- (Optional) Spotify Client ID & Secret — Spotify Developer Dashboard
-
Install system dependencies:
# Debian/Ubuntu sudo apt-get install ffmpeg cmake sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp \ -o /usr/local/bin/yt-dlp && sudo chmod a+rx /usr/local/bin/yt-dlp
-
Clone the repository:
git clone https://github.com/Firestone82/RustyTunes.git cd RustyTunes -
Copy
.env.exampleto.envand fill in your Discord token, YouTube API key, and optional Spotify credentials. -
Set up the database:
cargo install sqlx-cli sqlx database create sqlx migrate run
-
Build and run:
cargo build --release cargo run --release
- Create an application at discord.com/developers/applications.
- Under Bot, enable Message Content Intent and Server Members Intent.
- Copy the bot token into
.envasDISCORD_TOKEN. - Invite the bot via the OAuth2 URL generator with
bot+applications.commandsscopes andConnect,Speak, andSend Messagespermissions.
This project was created as a school assignment at VŠB-TUO.