Sleeptalk

Calls

Discord setup

Run a Discord bot that joins one voice channel in your server and talks only to the people you allow.

How it fits

A Discord bot is its own Sleeptalk profile. It reuses the speech key of your browser profile, so you only add a bot token. By default the bot is closed: it is locked to one server, one voice channel, and your Discord user ID.

You need a Discord server where you can add apps, a standard voice channel (stage channels are not offered), and the Discord extra installed in the Python that runs Sleeptalk:

Install the Discord extra
python -m pip install 'sleeptalk[discord]'

Voice also needs ffmpeg and libopus on the host. Sleeptalk checks for them, and for the optional davey package that adds Discord's DAVE voice encryption.

Set up from the settings page

Open the settings page with sleeptalk settings --open and go to Discord setup. The page walks through four steps.

1. Create the bot and paste its token

In the Discord Developer Portal, create a New Application. Its name becomes the bot's name. Open Bot, use Reset Token, and copy the token. Paste it into the page. Sleeptalk checks it with Discord and keeps it in this computer's private store. Leave the other toggles alone.

2. Add the bot to your server

Use the invite link the page shows. Pick your server, select Authorize, and leave the ticked permissions as they are. Then refresh the page.

3. Pick where to talk

Choose the server and one voice channel. Only channels where the bot can view, connect, speak, and use voice activity are eligible.

4. Lock the bot to you

Enter your Discord user ID and a profile name. On a computer: Settings, Advanced, turn on Developer Mode, then right-click your name and choose Copy User ID. The page writes the new profile and can install it as a service.

If this profile is already a Discord bot that is not locked yet, the same page offers to finish steps 2 to 4 with the saved token. An unlocked closed bot will not start.

Other ways to set it up

  • From a phone link. An agent that already talks to you in the browser can send a Discord setup link: sleeptalk host input link --request-id <id> --profile discord --surface discord --speech-from-profile default --workspace <dir> --agent <yours>. It opens the settings page on just the Discord steps: the bot token, adding the bot to your server, picking the channel, and locking it to your user ID. The bot's name, your servers, channels, and user ID travel encrypted; the hosted relay sees only ciphertext. The agent never sees the token. When you finish, the page stays open on the new profile's settings.
  • From the terminal. Run sleeptalk --discord and follow the prompts. It asks for the bot token, then who can talk to the bot.

Add the bot with the invite link Sleeptalk gives you. It requests the scopes bot applications.commands and exactly these permissions:

PermissionUsed for
View ChannelSeeing the voice channel and its chat
Send MessagesThe join confirmation and transcript lines
Read Message HistorySlash-command context
ConnectJoining the voice channel
SpeakPlaying replies
Use Voice ActivityListening without push-to-talk

If you build an invite in the Developer Portal's URL generator instead, it omits applications.commands unless you tick it. The bot then logs Missing Access and no slash commands appear. Re-invite it with Sleeptalk's link; re-inviting a bot already in the server updates its permissions in place.

Channel overrides can deny permissions granted at the server level. Discord documents permission precedence.

Privileged intents

Voice needs no privileged Gateway intents. Leave Presence, Server Members, and Message Content off unless you turn on one of these features:

FeatureProfile settingIntent needed
Text summons (@bot join in chat)voice_only = trueMessage Content
Reading posts from other bots in the roomparticipation_mode other than conversationalistMessage Content

Sleeptalk requests Message Content only when one of those is set. If Discord refuses the connection, sleeptalk doctor names the toggle to enable.

Who can talk to the bot

Setup writes a closed access list into the profile:

Profile fields written by setup
[transport]
type = "discord"
authorization_required = true
guild_id = "YOUR_SERVER_ID"
allowed_channel_ids = "VOICE_CHANNEL_ID"
operator_ids = "YOUR_USER_ID"

A profile that does not set authorization_required = false refuses to start until guild_id, allowed_channel_ids, and operator_ids are set. With the list in force:

  • Slash commands and text summons from anyone else are quietly rejected.
  • Speech from an unlisted user is dropped before it reaches speech-to-text.
  • The bot plays audio only while everyone in the channel is on the list. If someone else joins, playback stops for the rest of that session.
  • Only an operator can answer the agent's tool permission requests.

Add people with comma-separated user IDs:

FieldCan
operator_idsSummon the bot, talk, and approve agent tool permissions
speaker_idsTalk to the agent
listener_idsBe in the channel while it speaks

A speaker can ask the agent for anything its permission mode allows without a prompt. Stop the running bot before editing its profile, then start it again.

authorization_required = false lets anyone in the server summon the bot and talk to your agent, with whatever workspace access the agent has. The bot prints a warning at startup. Use it only in a server you fully control.

Join a call

Slash commands are registered only in the locked server. Use them in the chat of the allowed voice channel. Replace <profile> with the bot's profile name.

  1. Join the voice channel in Discord.
  2. In its chat, type /<profile> join. The bot joins and greets you.
  3. Ask the agent which workspace it is in, and confirm you hear the reply.
  4. Type /<profile> leave to disconnect.

Other commands include status, settings (narration, response length, and speech speed), ask for a text reply, and link for a private browser call link. A voice_only profile exposes only settings; you summon it by mentioning the bot while you are in the voice channel. Automatic joining when someone enters the channel is off by default.

Keep it running

Run in the foreground
sleeptalk run --config /path/to/discord.toml

To keep it running across logins, install it as a user service and start it with the command it prints. The settings page's Keep it running button does the same.

Install as a service
sleeptalk service install discord --yes

Use one bot per runtime. Do not run the same bot token from two places. See deployment for service details.

Common setup failures

  • No slash commands, or Missing Access in the log: the bot was added without applications.commands. Re-invite it with Sleeptalk's link.
  • Gateway close 4014: the profile turns on text summons or room reading. Enable Message Content in the Developer Portal, or turn that feature off.
  • Bot refuses to start: the profile is closed but missing guild_id, allowed_channel_ids, or operator_ids. Finish the lock step on the settings page.
  • Bot joins but does not hear you: your user ID is not in operator_ids or speaker_ids, or you are in a channel that is not allowed.
  • Bot goes silent when someone joins: that person is not listed. Add them to listener_ids and rejoin.
  • Opus errors on start: install libopus (brew install opus or sudo apt install libopus0), or set opus_library in the profile.

A passing setup check does not prove you can hear the bot. Always test a spoken exchange.