Docs
The music player
tether ships the player, not a music bot. Any bot can drive it through one route and a few interactions.
tether does not ship a music bot. It ships the player: the now-playing strip, card, panel, sidebar and mini player, and the "Play music" entry in the Now panel. Any bot can drive it through the API on this page; a server with no music bot shows no player. Everything here is in Discord's shapes where Discord has one; Discord has no player, so the player's parts are tether-only.
1. Set up a music bot
Make the bot (Getting started) and mark it as a music bot: switch on Music player on the bot's General page in the developer portal, or send Modify Bot
{"player": true}. Only then may it use the player routes.Someone with Manage Server adds it to the server (the add link, or Add Bot to Server).
The same person sets it up under Server settings › Music, or with Modify Server Bot Settings:
{ "prefix": "k!", "player": { "enabled": true, "control": "in_call", "control_role_ids": [], "hide_in_voice": false } }prefixis what the server registered for the bot. A bot reads the text of messages that start with it (or mention it): Privacy for bots.player.enabled: the player is on for this bot in this server. Off, its controls are gone and its state is refused (40390215).player.control: who may press the controls:in_call(anyone in the call) orroles(members with one ofcontrol_role_ids; Manage Server counts as having one). Moderators (Manage Server or Move Members) may always stop it, even from outside the call.player.hide_in_voice: see "Hiding" below.
Everyone in the server can read these (List Server Bots); a change reaches them as
GUILD_BOT_SETTINGS_UPDATE. Defaults: nothing registered, the player on, anyone in the call, not hidden.
2. Join the call
Like any member, with gateway opcode 4, then connect to the LiveKit room and publish one microphone track: Voice. The bot needs Connect to join and Speak to publish.
3. Report what is playing
Put Player State (the bot, in that voice channel):
{
"now_playing": {
"id": "yt:abc123",
"title": "Harder Better Faster",
"artist": "Daft Punk",
"duration_ms": 224000,
"art_url": "https://cdn.example.com/cover.jpg",
"requested_by": { "id": "106…", "name": "josh" },
"is_autoplay": false,
"position_ms": 5000,
"position_at": "2026-10-21T10:00:00Z"
},
"paused": false,
"queue": [{ "id": "…", "title": "…", "artist": null, "duration_ms": null, "art_url": null }],
"queue_length": 14,
"recent": [],
"toggles": [
{
"id": "autoplay",
"label": "Autoplay",
"icon": "autoplay",
"on": true,
"description": "Keeps the vibe going after the queue."
}
],
"rating": true
}
- Send it on change only, not every second: progress is
position_msatposition_atplus the time since, unless paused.position_atis optional; the server stamps its own clock when you leave it out. - It replaces the whole state.
queueis at most the next 10 songs (queue_lengthis the whole queue),recentat most the last 10 played, newest first. A song is{id, title, artist, duration_ms, art_url}(idis yours and opaque to tether;requested_byandis_autoplayare optional). toggles: up to four switches of your own (id[a-z0-9_-], label up to 24 characters, an optional one-linedescription). They show as switches in the panel and, while on, as small symbols next to the title.iconis one ofautoplay hush star heart moon sparkle bolt radio note speaker.rating: trueshows like, dislike and favourite buttons; the presses reach you asplayer:rate:*.art_urlis anhttp(s)address. Clients never contact it: tether rewrites it to a signed link on its own picture proxy (the same fetcher link previews use; PNG, JPEG, GIF or WebP up to 6 MB).- It answers
200with the state as clients get it (APIPlayerState). 20 per 5 seconds.
End Player ends it (204, also when there is nothing to end): the player
disappears, and a bot hidden by "Hide in voice channels" is visible again. Get Player
returns the state to anyone who can see the channel (active: false when no bot plays there).
| Status | Code | Why |
|---|---|---|
| 403 | 90212 |
The bot is not marked as a music bot (or the caller is a person). |
| 400 | 90213 |
The bot is not in that voice channel (join first with opcode 4). |
| 403 | 90215 |
The player is off for this bot in this server. |
| 409 | 90214 |
Another bot already drives that channel. |
| 400 | 90218 |
Nobody (no person) is in the call: a player plays to people. |
| 404 | 90216 |
DELETE while another bot owns the player (no player at all is 204). |
One bot owns a channel's player. The first to PUT owns it until it ends. It ends when the bot leaves
voice, when the last person leaves the call, when the player is switched off for the bot in this server,
when its maker takes the player flag away, or when the bot DELETEs it. Clients get
PLAYER_STATE_UPDATE (the state, active: false when it ended) and GUILD_CREATE.player_sessions; only
people who can see the channel receive them. Sessions live in the server's memory: a restart ends them,
so a bot should PUT again after it reconnects.
4. Controls arrive as interactions
Every button of the player sends the bot a Discord-shaped INTERACTION_CREATE
(Buttons and interactions), after tether checked that the person is
allowed to. A bot never gets a press that was not allowed. The interaction has channel_id and
player: {channel_id} set to the voice channel, member and user (who pressed) and no message.
custom_id |
Interaction type | Needs | What it means |
|---|---|---|---|
player:pause, player:resume |
3 (component) | control | Pause or resume. |
player:skip |
3 | control | Skip the song. |
player:stop |
3 | stop (moderators from anywhere) | Stop and leave. |
player:play:<n> |
3 | control | Play the song at place n (0 to 9) of the queue preview now. |
player:toggle:<id> |
3 | control | Flip your switch <id> (you decide the new value; no value is sent). |
player:rate:<like|dislike|favourite|unfavourite> |
3 | listen | Personal: rate the playing song. Only with rating: true. |
player:add |
5 (modal submit) | control | Add a song or link: Discord's modal submit, the text is the one text input (custom_id: "text", 500 characters at most). |
player:search |
4 (autocomplete) | listen | The text so far is in data.options[0].value (and tether's data.value): a search as you type. |
Switches, ratings and play:<n> are checked against what you reported: a switch you did not offer, a
rating without rating: true, or a place past the queue is refused with 400 before you hear of it.
Answer like any interaction, within 3 seconds: type 6 ("nothing to show") for almost everything;
type 4 with flags: 64 for a short note only that person sees (clients show it as a toast); type 8 for
a search.
Adding a song when nothing plays. The first press of "Play music" is a player:add with the bot's id
(player: {channel_id, bot_id}): the bot gets it as a type 5 interaction. Join the person's voice channel
yourself (opcode 4), start playing, and PUT the state. interaction.member and interaction.channel_id
tell you who and where.
Search as you type (type 4): answer with up to 12 choices, Discord's name and value (100
characters each) plus tether-only fields shown in the list:
{
"type": 8,
"data": {
"choices": [
{
"name": "Harder Better Faster",
"value": "yt:abc123",
"artist": "Daft Punk",
"duration_ms": 224000,
"art": "https://cdn.example.com/cover.jpg"
}
]
}
}
Picking a choice sends player:add with the choice's value as the text. art goes through the
picture proxy like the player's art. The fields beyond name and value are not part of Discord's
choice, so a library's own helper cannot send them; send the JSON yourself for a richer list.
What a library does with these
- The form (
player:add) is a Discord modal submit with Labels:data: {custom_id: "player:add", components: [{type: 18, id: 1, component: {type: 4, id: 2, custom_id: "text", value: "…"}}]}. discord.py 2.6+ (Modal._refresh) and discord.js 14.2x (ModalSubmitFields) read it; an older library sees no fields, which is harmless. Answer it withinteraction.response.defer()(callback type 6). - The search is Discord's autocomplete of a command named
player. Acommands.Botwith an app command tree looks the command up, finds none, and logs "Ignoring exception in command tree" for each keystroke. A bot built ondiscord.Client, or one that overridesCommandTree.on_error(or answers the interaction inon_interactionfirst), does not. - The controls (
player:*, type 3) are ordinary component interactions with nomessage; a library's view dispatch ignores acustom_idit has no view for, andon_interactionsees them.
Who may press what
One shared rule decides on the server, before anything is forwarded: view needs View Channel; listen,
control and stop need being in the call; in roles mode control and stop also need a listed role;
moderators (Manage Server or Move Members) may always stop. Refusals are 403: 90217 not in the
call, 90215 the player is off for this bot, 50013 missing role.
5. Hiding in voice channels
A per-server, per-bot switch (off by default, Manage Server). While it is on and the bot has a
player session in that channel with a song playing (now_playing is not null), its voice state is
hidden: no face in the channel list or the call, not in "N in voice", not counted towards user_limit.
Viewers are told the bot left; GUILD_CREATE.voice_states and VOICE_STATE_UPDATE skip it (only the bot's
own view has it). Every PUT decides again: an idle session (now_playing: null), a DELETE or leaving
voice make the bot visible at once, whatever the switch says. With the switch off the bot counts and shows
like any member. Moderators can still disconnect it
(PATCH /guilds/{guild.id}/members/{bot.id} with {"channel_id": null}).
What hiding is not. A bot in a voice channel can hear everyone, like a person, whether it is visible or hidden. Hiding is about who sees the bot, not about what it can hear: Privacy for bots.
A player plays to people: PUT is refused with 400 90218 when no person is in that voice channel, and an
existing player ends when the last person leaves, is disconnected or moves away. A hidden bot that becomes
visible while the channel is at its user_limit stays visible; the next join is refused.
6. A small example
A bot in Node (ws; livekit left out, so it publishes nothing):
import WebSocket from 'ws';
const BASE = 'https://app.tethr.lol',
TOKEN = process.env.BOT_TOKEN;
const rest = (method, path, body) =>
fetch(`${BASE}/api/v1${path}`, {
method,
headers: { authorization: `Bot ${TOKEN}`, 'content-type': 'application/json' },
body: body && JSON.stringify(body),
});
const ws = new WebSocket(`${BASE.replace('http', 'ws')}/gateway?v=1&encoding=json`);
ws.on('message', async (raw) => {
const { op, d, t } = JSON.parse(raw);
if (op === 10) {
setInterval(() => ws.send(JSON.stringify({ op: 1, d: null })), d.heartbeat_interval);
// GUILDS | GUILD_VOICE_STATES | GUILD_MESSAGES | MESSAGE_CONTENT
ws.send(
JSON.stringify({ op: 2, d: { token: `Bot ${TOKEN}`, intents: 1 | 128 | 512 | 32768 } }),
);
}
if (t === 'INTERACTION_CREATE' && d.player) {
if (d.data.custom_id === 'player:skip') {
// ... skip, then tell tether (on change only):
await rest('PUT', `/channels/${d.player.channel_id}/player`, {
now_playing: null,
paused: false,
queue: [],
queue_length: 0,
});
}
await fetch(`${BASE}/api/v1/interactions/${d.id}/${d.token}/callback`, {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ type: 6 }),
});
}
});
The repository's fake music bot, apps/server/src/player/fake-music-bot.ts, is a complete one (made-up
songs, no audio, only this API); pnpm dev:lite --seed --fake-music-bot adds it to the seeded server as
"Groove".
7. Limits and notes
- A player has at most 4 switches, a queue preview of 10 and a history of 10.
- The player's interactions and sessions live in memory: run a single tether process.
- Text commands (
k!play …) are the bot's own: it reads them fromMESSAGE_CREATElike on Discord and replies with ordinary messages with embeds and buttons. tether forwards nothing for it.