How jontze/cadency-rs works
Cadency-rs is a Discord slash-command bot. A user invokes a command through Discord; the bot dispatches it, performs the command’s domain work, and returns a response. Music commands cover playback and queue control, with playlist support documented separately. Other branches provide utility and entertainment commands. Internally, a procedural derive crate generates command metadata and argument accessors. The excerpts show startup, dispatch, shared voice helpers, and code generation; most command implementations were not sampled, so their internal call paths are not asserted.
Main entry points: command.rs Command dispatch · client.rs Cadency client · play.rs Play and enqueue · main.rs Bot startup
Components 29
Bot runtime
- Bot startup
cadency/src/main.rs - Bot settings
cadency/src/settings.rs - Cadency client
cadency_core/src/client.rs - Command dispatch
cadency_core/src/handler/command.rs - Command model
cadency_core/src/command.rs - Response handling
cadency_core/src/response.rs - Voice and tracks
cadency_core/src/utils/voice.rs - HTTP client
cadency_core/src/http.rs
Music commands
- Play and enqueue
cadency_commands/src/play.rs - YouTube playlists
cadency_yt_playlist/src/playlist.rs - Queue controls
cadency_commands/src/tracks.rs - Track looping
cadency_commands/src/track_loop.rs - Current track
cadency_commands/src/now.rs - Pause playback
cadency_commands/src/pause.rs - Resume playback
cadency_commands/src/resume.rs - Skip track
cadency_commands/src/skip.rs - Stop playback
cadency_commands/src/stop.rs
Other commands
- Fibonacci
cadency_commands/src/fib.rs - Inspiring message
cadency_commands/src/inspire.rs - Ping pong
cadency_commands/src/ping.rs - Trout slap
cadency_commands/src/slap.rs - Urban Dictionary
cadency_commands/src/urban.rs - Roll command
cadency_commands/src/roll/command.rs - Dice parser and roller
cadency_commands/src/roll/dice.rs
Command codegen
- Derive implementation
cadency_codegen/src/derive.rs - Argument generation
cadency_codegen/src/argument.rs - Command metadata
cadency_codegen/src/command.rs
Other components
- Discord user
- Discord API
Connections 29
- Discord user → Discord API: invokes command
README.md - Discord API → Command dispatch: delivers interaction
cadency_core/src/handler/command.rs - Bot startup → Bot settings: parses settings
cadency/src/main.rs - Bot startup → Cadency client: builds and starts
cadency/src/main.rs - Cadency client → Command dispatch: registers handler
cadency_core/src/client.rs - Command dispatch → Command model: registers commands
cadency_core/src/handler/command.rs - Command dispatch → Response handling: submits response
cadency_core/src/handler/command.rs - Command dispatch → Discord API: registers slash commands
cadency_core/src/handler/command.rs - Cadency client → Discord API: starts client
cadency_core/src/client.rs - Play and enqueue → Voice and tracks: adds songs
- Voice and tracks → HTTP client: gets HTTP client
cadency_core/src/utils/voice.rs - Play and enqueue → YouTube playlists: supports playlist input
- Command dispatch → Play and enqueue: dispatches commands
- Command dispatch → Queue controls: dispatches commands
- Command dispatch → Track looping: dispatches commands
- Command dispatch → Current track: dispatches commands
- Command dispatch → Pause playback: dispatches commands
- Command dispatch → Resume playback: dispatches commands
- Command dispatch → Skip track: dispatches commands
- Command dispatch → Stop playback: dispatches commands
- Command dispatch → Fibonacci: dispatches commands
- Command dispatch → Inspiring message: dispatches commands
- Command dispatch → Ping pong: dispatches commands
- Command dispatch → Trout slap: dispatches commands
- Command dispatch → Urban Dictionary: dispatches commands
- Command dispatch → Roll command: dispatches commands
- Roll command → Dice parser and roller: uses dice logic
cadency_commands/src/roll/command.rs - Derive implementation → Argument generation: generates accessors
cadency_codegen/src/derive.rs - Derive implementation → Command metadata: builds metadata
cadency_codegen/src/derive.rs