Discord Testing
Discord voice testing mode for bots that live in voice channels. A separate tester bot joins the channel, speaks synthetic caller audio, receives the bot-under-test audio, and runs the same scenario loop.
#API
TS
import { runScenario } from "@absolutejs/voice-tester";
import { adversarialScenario } from "@absolutejs/voice-tester/scenarios";
import { discordVoiceTransport } from "@absolutejs/voice-tester/discord";
const transport = await discordVoiceTransport({
token: process.env.DISCORD_TESTER_TOKEN!,
guildId: "1234567890",
channelId: "9876543210",
targetUserId: "1122334455"
});
const report = await runScenario({
transport,
scenario: adversarialScenario({ llm: {} }),
tts: { apiKey: process.env.DEEPGRAM_API_KEY! },
stt: { apiKey: process.env.DEEPGRAM_API_KEY! }
});#Setup
Create a separate Discord application for the tester. It cannot be the same bot as the target because the tester must subscribe to another user audio stream.
Enable the normal Guilds and Guild Voice States behavior. Presence and Message Content privileged intents are not required.
Invite the tester bot with Connect, Speak, and Use Voice Activity permissions. Add View Channel only when the channel is role-restricted.
Turn on Discord Developer Mode and copy the guild ID, voice channel ID, and optional target user ID for the bot under test.
Install optional peers only for Discord mode: @discordjs/voice, discord.js, and prism-media.
#CLI
BASH
DISCORD_TESTER_TOKEN=Bot.your_tester_bot_token bunx @absolutejs/voice-tester \
--mode discord \
--guild 1234567890 \
--channel 9876543210 \
--target-user 1122334455 \
--scenario adversarial \
--duration 90#Gotchas
Connection timeouts usually mean the tester bot can see the guild but cannot enter the voice channel.
If the bot joins but no audio is transcribed, confirm recent @discordjs/voice and prism-media versions and verify the target bot is actually emitting audio.
When multiple people are in the channel, pass --target-user so the tester forwards only the bot-under-test audio to STT.
The tester destroys the Discord client on scenario completion; an interrupted process can leave the gateway open briefly before Discord times out the connection.
Missing Permissions errors usually mean channel-level Speak permission is missing for the tester bot role.