Skip to content

const voice: object

Defined in: sdk/js/src/voice.ts:35

The bot’s voice stay and player. Errors throw ZaunError (FORBIDDEN without grants).

clearQueue(): void

Empties the queue; unlike stop, the current track keeps playing.

void

endStream(): void

The pushed track ends once its buffer has played.

void

enqueue(t): number

Adds to the queue (≤ 100); returns its length.

string | TrackOptions

number

join(channelId): void

Joins a voice channel (leaving another first); returns once audio can flow.

string

void

leave(): void

Leaves; playback stops and the queue clears.

void

moveTrack(from, to): void

Moves the queued track at from to to (both 0-based); the tracks between shift.

number

number

void

pause(): void

void

play(t): void

Plays now, replacing the current track (a string is a URL).

string | TrackOptions

void

push(packets): number

Opus packets for the current pushed track; returns ms buffered (BUSY past 3 s).

Uint8Array<ArrayBufferLike>[]

number

remove(index): string

Removes the queued track at index (0 plays next); returns its title. Throws NOT_FOUND past the end. Like every queue call, UNSUPPORTED on hosts without queue control.

number

string

resume(): void

void

seek(ms): void

Jumps to ms into the current track; past the end, the track ends. Throws UNSUPPORTED for live streams and pushed audio, and on hosts that cannot seek; CONFLICT when nothing plays.

number

void

setLoop(mode): void

Sets what happens when a track ends.

LoopMode

void

setVolume(percent): void

Sets the playback volume, 0–200 % (100 when the bot joins). Throws ZaunError BAD_REQUEST (detail percent) outside 0–200, checked before the call, and UNSUPPORTED on hosts without an Opus encoder, which is most of them for now: tell the member and go on.

number

void

shuffle(): void

Puts the queue in a random order; the current track keeps playing.

void

skip(): void

void

state(): VoiceState

VoiceState

stop(): void

Ends the current track and clears the queue.

void