feat(bot): userbot (selfbot) mode — voice conversation on one user account (stage 1)

A user account is the only kind Discord lets Go Live, so add a userbot run mode:
when DISCORD_BOT_TOKEN is absent but DISCORD_SELFBOT_TOKEN is set, the app runs
as a userbot instead of the normal slash-command bot.

Stage 1 (conversation): log in with discord.js-selfbot-v13, auto-join
DISCORD_VOICE_CHANNEL_ID on startup (or "!자비스 join" when unset), listen via the
selfbot VoiceReceiver (pcm), transcribe+reply through the bridge, and speak the
reply back with playAudio. Shared PCM/WAV helpers extracted to audio.ts.
run-bot.sh now starts in either userbot or normal mode. Go-Live broadcast +
broadcast-coupled routing land in stage 2 on the same voice connection.

ToS note: selfbots violate Discord ToS; burner account only.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-06-11 11:08:39 +09:00
parent 03375a77d0
commit 921a757371
5 changed files with 226 additions and 10 deletions

View File

@@ -17,10 +17,16 @@ function opt(name: string, fallback = ""): string {
export type StreamBackend = "selfbot" | "novnc" | "screenshot" | "none";
export const config = {
// --- Normal Discord bot (voice I/O, slash commands) ---
botToken: req("DISCORD_BOT_TOKEN"),
appId: req("DISCORD_APP_ID"),
// --- Discord identity ---
// Normal bot token/appId are OPTIONAL: when absent (and a selfbot token is
// present) the app runs in userbot mode (one user account does voice +
// Go-Live). When present, the legacy normal-bot + slash-command path runs.
botToken: opt("DISCORD_BOT_TOKEN"),
appId: opt("DISCORD_APP_ID"),
guildId: req("DISCORD_GUILD_ID"),
// Userbot auto-join: if set, the userbot joins this voice channel on startup;
// if empty, it waits for a text command (e.g. "!자비스 join") to join.
autoJoinChannelId: opt("DISCORD_VOICE_CHANNEL_ID"),
// --- Python brain bridge ---
bridgeUrl: opt("BRIDGE_URL", "http://127.0.0.1:8765"),