Skip to main content

Discord voice selfbot

Play local audio, YouTube, or SoundCloud in a voice call, speak text with eSpeak, and record and transcribe other participants locally with WhisperStreaming.

Setup

Use Python 3.11 or newer. Install FFmpeg for link playback and other audio formats, eSpeak NG (or eSpeak) for >tts, and the Opus shared library for voice. On Debian or Ubuntu:

sudo apt install ffmpeg espeak-ng libopus0 python3-venv
python3 -m venv .venv
make install                 # or: .venv/bin/pip install -e ".[dev]"

make install creates the virtualenv if needed and installs the project in editable mode, which also puts the vcbot command on the environment's PATH.

CPU transcription needs no CUDA libraries. For NVIDIA GPU transcription, install CUDA 12 cuBLAS and cuDNN 9. On Linux or WSL, the bot loads them from the system or from NVIDIA's wheels installed in the same Python environment:

make install-cuda            # or: .venv/bin/pip install -e ".[cuda]"

On Windows, make the CUDA and cuDNN DLLs available on PATH.

Set DISCORD_USER_TOKEN in the environment and run vcbot. From a checkout that is not installed, python -m vcbot is equivalent. Keep the token out of source files and shell history. This program signs in as a user account; Discord prohibits selfbots on its platform.

Startup options

Run vcbot --help to see every option. Flags override environment variables, which override built-in defaults. Leave the token in DISCORD_USER_TOKEN when possible; a token passed as --discord-user-token (--token) can appear in shell history and in the process list.

vcbot --whisper-backend cpu --whisper-model base --whisper-streams 1
vcbot --prefix '!' --reply-delete-after 30 --recordings-dir ./voice-logs --debug
Flag Environment variable Default
--discord-user-token DISCORD_USER_TOKEN Required
--prefix SELFBOT_PREFIX >
--reply-delete-after SELFBOT_REPLY_DELETE_AFTER 20 seconds
--voice-timeout SELFBOT_VOICE_TIMEOUT 20 seconds
--tts-voice SELFBOT_TTS_VOICE en-us+whisper
--tts-speed, --tts-pitch, --tts-amplitude SELFBOT_TTS_SPEED, SELFBOT_TTS_PITCH, SELFBOT_TTS_AMPLITUDE eSpeak defaults; each >tts call can override them
--recordings-dir SELFBOT_RECORDINGS_DIR ./recordings
--whisper-model WHISPER_MODEL turbo
--whisper-language (--whisper-lang) WHISPER_LANGUAGE en; auto detects the language on every chunk
--whisper-vad / --no-whisper-vad WHISPER_VAD=1 Off; runs Silero VAD on each chunk to drop non-speech
--whisper-backend (--whisper-device) WHISPER_BACKEND auto (CUDA if visible, otherwise CPU); also accepts cpu and cuda
--whisper-streams WHISPER_STREAMS 2 on CPU or 4 on CUDA
--whisper-workers WHISPER_WORKERS Available logical CPUs, capped at 32 by default
--whisper-vram-percent WHISPER_VRAM_PERCENT 75% (CUDA only)
--whisper-chunk-seconds WHISPER_CHUNK_SECONDS 2 seconds (1–10)
--whisper-pause-seconds WHISPER_PAUSE_SECONDS 1 second
--debug / --no-debug SELFBOT_DEBUG=1 Off

Commands

Type these as regular messages. Replies, including help and transcript attachments, are visible in the conversation before being deleted after about 20 seconds. Only the signed-in account can run commands directly; other users can invoke @mention >tts ....

Command What it does
>help, >ping Show command help or gateway latency.
>join [voice channel or link] or >join <server_id> <channel_id> Join the current DM/group call or a server voice channel. Links and ID pairs work from outside that server.
>vc_active Show which voice session this conversation controls, including connection, playback, and recording status.
>vc_list List who is connected and whether each person is muted or deafened. Uses the current voice channel's chat, your connected channel in the server, or the active DM/group call.
>diagnostics Check gateway and voice connectivity, local tools, and recording packet and queue counts.
>tts [options] <text> Speak text in the active call.
>voices [query] List or filter installed voices and variants.
>play <url or path> Play a public YouTube or SoundCloud link, or an audio file on the machine running the bot. Links use yt-dlp and FFmpeg.
>pause, >resume, >skip Control active playback. Recording continues independently.
>models List the model names accepted by >record, including models that download on first use.
>record [--language <code|auto>] [--vad|--no-vad] [model] Start recording and transcribing the active call. The language defaults to the configured en and skips per-chunk language detection. VAD defaults to the configured value.
>log <n> Show the last n lines of the current or latest transcript. Long results are sent as an attachment.
>stop Finish writing the recording and transcript without leaving voice.
>leave Disconnect and finish any active recording.

In a server, try >join General Voice or pass a channel mention or ID. With no argument, >join uses the voice channel whose chat you are typing in or the channel the signed-in account is currently in. To join from another server or a private conversation, send >join <server_id> <channel_id> or >join https://discord.com/channels/<server_id>/<channel_id>. The signed-in account needs access to that channel. After a remote join, you can run voice commands in the conversation that started the join or in the destination server. Replies (including >vc_list and >log) appear where you run the command. Run >join for a local channel or call to switch that conversation back to local controls.

TTS options go before the text: --voice (-v, default en-us+whisper), --speed (-s, 80–450 words per minute), --pitch (-p, 0–99), and --amplitude (-a, 0–200). Example: >tts --voice fr --speed 140 Bonjour. Loud playback and TTS leave 6 dB of peak headroom before Opus encoding. Recording also leaves 6 dB of headroom inside the Opus decoder before saving 16-bit WAV files.

Troubleshooting

  • Run >ping to verify commands are reaching the bot. Run >vc_active to see where voice commands will go. If Discord shows you in voice but the bot has no connection, run >join to establish its audio session.
  • Run >diagnostics while recording to see whether voice packets arrive and decode. The decoded count excludes Discord's silence packets; a low count while nobody is speaking is normal. Opus may report "not loaded yet" before the first use.
  • Start with vcbot --debug for command, voice, playback, and recording logs in the terminal.

Recording

WhisperStreaming runs a separate online processor for each speaker. During continuous speech it receives audio about every two seconds by default, confirms words that agree across successive passes, and trims completed segments to keep the working audio window short. A pause, speaker disconnect, or recording stop flushes any remaining words. WhisperStreaming uses faster-whisper and CTranslate2 as its local inference engine on CPU and CUDA.

Use >record base for a lighter model, especially on CPU. Model selection follows the command argument, then the configured default (turbo). The first use of a model may download its CTranslate2 weights from Hugging Face; previous OpenAI Whisper .pt files are not used. WHISPER_STREAMS caps the total number of loaded or loading Whisper instances across all calls and model names in the process. The default is 2 on CPU or 4 on CUDA. Set it to 1 if RAM or VRAM is limited. Idle instances are reused or evicted if another model needs their slot.

Whisper detects the spoken language separately on every chunk unless one is given. Set --whisper-language es (or WHISPER_LANGUAGE) to make that the default for every recording, or pass >record --language es to override it for one session. Use auto to keep detecting. Fixing the language removes the detection pass from each inference, and >vc_active and >diagnostics show the language in use. English-only models (base.en and similar) only accept en (or auto, which still transcribes as English).

Voice activity detection is off by default. Set --whisper-vad (or WHISPER_VAD=1) to run faster-whisper's bundled Silero VAD over each chunk and drop non-speech before transcription, which avoids hallucinated lines on music, noise, or silence. Pass >record --vad or >record --no-vad to override it for one session. This is the vendored --vad option; the vendored --vac option is not ported because it expects 40 ms chunks and downloads a Torch model, while this bot already splits audio per speaker and flushes on pauses. VAD state appears in >vc_active and >diagnostics.

The transcription worker pool is sized separately, using the logical CPUs available to the process (at least 1 and at most 32). On CUDA, model admission also targets 75% of total GPU memory by default. Set WHISPER_VRAM_PERCENT to a whole number from 1 to 100 to change that target. The check accounts for other GPU usage and reserves an estimated inference footprint for each Whisper instance, including loads in progress. The effective instance limit can therefore be lower than WHISPER_STREAMS. The budget is an estimate: inference peaks and memory changes in other processes can still cause higher usage. It does not apply to CPU recording.

Each session writes <session>/transcript.txt under the recordings directory and <user_id>.wav tracks in the same directory. The WAVs contain captured speech chunks at 48 kHz stereo; they omit gaps with no received audio. Silence, near-silence, and brief spikes are skipped before Whisper inference; captured audio is still saved to the WAV tracks. Processed lines appear in the terminal as well as the transcript. Each call can queue up to 32 audio chunks or 60 seconds of audio, whichever fills first. Under sustained load, the recorder continues saving WAVs and skips new transcription work when the queue is full. >diagnostics shows the skipped audio duration. >stop waits for queued transcription to finish. Record only with participants' knowledge and permission.

Packaging

The project is a PEP 517 package built with hatchling, so pip install . and uv build both work. vcbot is a console script (vcbot = "vcbot.cli:main") and python -m vcbot runs the same entry point; the version lives in vcbot/__init__.py.

make build      # dist/vcbot-<version>.tar.gz and dist/vcbot-<version>-py3-none-any.whl
make check      # build, install the wheel in a scratch venv, run --version and --help

make test runs the unit tests with unittest; make lint runs ruff over the package, with the vendored WhisperStreaming code excluded.

setup.py is a shim for tooling that still expects one: it reads every field back out of pyproject.toml at build time, so it cannot drift. pyproject.toml remains authoritative and hatchling remains the build backend.

Continuous integration

.github/workflows/ci.yml runs on every push to master and on pull requests:

  • lint — ruff over vcbot/ and setup.py.
  • test — the unit tests, the console script and python -m vcbot on Python 3.11, 3.12 and 3.13.
  • package — builds the sdist and wheel, installs each into a throwaway environment, then checks the wheel layout (no tests, vendored LICENSE present, vcbot = vcbot.cli:main) and that setup.py reports the same name and version as the package.

Pushing a v* tag runs .github/workflows/release.yml, which refuses to publish unless the tag matches vcbot/__init__.py, then attaches the built artefacts to a GitHub release.

Code layout

Everything below lives in the vcbot/ package.

  • cli.py parses the command line and then imports the application, so --help and argument errors never load Discord or Whisper.
  • config.py defines startup options, environment fallbacks, and defaults.
  • main.py registers commands, handles voice connections and playback reservations, and sets the reply deletion timer.
  • speech.py prepares audio from eSpeak, local files, or yt-dlp links.
  • transcription.py receives Discord voice packets, segments audio, and writes WAVs and transcripts using bounded Whisper concurrency. While recording, it keeps the voice UDP socket active through quiet periods.
  • whisper_backend.py connects WhisperStreaming processors to the shared model pool and checks CUDA VRAM.
  • vendor/whisper_streaming/ contains the online WhisperStreaming module and license derived from WhisperStreaming revision 6da90b4.

Metadata

Release files for vcbot 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vcbot 0.1.0
File Size Uploaded Provenance Actions
vcbot-0.1.0.tar.gz 56.4 kB Without provenance Details for vcbot-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vcbot 0.1.0
File Interpreter ABI Platform Actions
vcbot-0.1.0-py3-none-any.whl Python 3 none any Details for vcbot-0.1.0-py3-none-any.whl

Total release size: 106.3 kB

Release files / vcbot-0.1.0.tar.gz

Download URL vcbot-0.1.0.tar.gz
Size 56.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f91677a9a11783cc989397cc247e717713daf60227ccbcae88297e7a1533dde5
BLAKE2b-256 checksum
How to use checksums
904208435df2c919e63eb90bdc601299456099c8336b1fba4ee99cfadcafa4c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / vcbot-0.1.0-py3-none-any.whl

Download URL vcbot-0.1.0-py3-none-any.whl
Size 49.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1916f2dda7bfb15bdb6e63024a86166d71c79a47fd7bb29216ecb73ecdbdb306
BLAKE2b-256 checksum
How to use checksums
e26a7be1bfc5ae6d8403ccf9aa9841f21db628569c7c9e83388e373015fd3daa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for vcbot 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page