Expand description
Voice channels (capability voice, ADR-0020). The host joins as the bot, end-to-end
encrypted like any member, and plays audio for it in real time: the bot only says what to
play. One stay per bot; CONNECT and SPEAK apply as for members. Nothing is transcoded,
so audio is Opus: Ogg Opus files and streams (.opus, .ogg holding Opus), WebM Opus
(audio/webm, YouTube’s itag 251) on hosts that demux it, or Opus packets the bot makes.
Structs§
- Track
- Something to play.
- Voice
State
Enums§
- Loop
Mode - What happens when a track ends: go on (
off), play it again (track), or put it at the end of the queue (queue). - Player
Status - Source
- Where a track’s audio comes from.
- Voice
Event - What happened, for
on-voice-event.
Functions§
- clear_
queue - Empties the queue; the current track keeps playing.
- end_
stream - The
pushedtrack ends once its buffered packets have played. - enqueue
- Adds
trackto the queue (≤ 100); returns the queue’s length. - join
- Joins voice channel
channel(leaving another one first). Returns once media can flow (at most about 10 s).FORBIDDENwithoutvoice,CONNECTorSPEAK. - leave
- Leaves; playback stops and the queue is cleared.
- move_
- Moves the queued track at
fromtoto(both 0-based); the tracks between shift.NOT_FOUNDpast the end. - pause
- play
- Plays
tracknow, replacing the current one; the queue stays. - push
- Opus packets (2.5 to 120 ms each, ≤ 1000 bytes) for the current
pushedtrack. Returns the audio buffered, in ms;BUSYpast 3 s, so push about as fast as it plays. - remove
- Removes the queued track at
index(0 plays next); returns its title.NOT_FOUNDpast the end. - resume
- seek
- Jumps to
msinto the current track (past the end: the track ends).UNSUPPORTEDfor live streams and pushed audio, and on hosts that cannot seek;CONFLICTwhen nothing plays. - set_
loop - Sets what happens when a track ends (
offwhen the bot joins). - set_
volume - Sets the playback volume, 0-200 % (100 when the bot joins;
BAD_REQUESTabove 200). Changing it means decoding and re-encoding the Opus audio, so hosts without an Opus encoder answerUNSUPPORTED: call it anyway and tell the member. - shuffle
- Puts the queue in a random order (the current track keeps playing).
- skip
- Ends the current track; the next one starts.
- state
- Where the bot is and what it plays.
- stop
- Ends the current track and clears the queue.