Files
javis_bot/docker/run-bot.sh
javis-bot 964123682f
Some checks failed
Release / semantic-release (push) Successful in 21s
tests / Unit tests (Linux, Python 3.11) (push) Successful in 9m53s
Release / build-linux (push) Failing after 7m12s
Release / build-windows (push) Has been cancelled
Release / build-macos (arm64, macos-latest) (push) Has been cancelled
Release / build-macos (x64, macos-15-intel) (push) Has been cancelled
Release / release-main (push) Has been cancelled
Release / release-develop (push) Has been cancelled
Review fixes: correct Piper TTS API + bot env gating
Code review of the bridge/bot/docker work found:
- TTS bug: bridge called PiperVoice.synthesize(text, wav) but that method
  returns AudioChunks and takes a SynthesisConfig as its 2nd arg, not a wav
  file -> TTS would fail. Switched to synthesize_wav(text, wav_file).
  Verified: produces a valid 22050Hz mono WAV.
- run-bot.sh now waits if ANY of DISCORD_BOT_TOKEN/APP_ID/GUILD_ID is missing
  (config.ts throws on a missing one), preventing a supervisor crash-loop.

Verified clean: discord.js Events.ClientReady == 'clientReady' (existing
handler correct); image rebuilds.
2026-06-09 16:16:55 +09:00

26 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Wait for the brain bridge, then run the Discord bot.
#
# The Discord token is intentionally deferred: if DISCORD_BOT_TOKEN is not set
# yet, the rest of the stack (desktop, bridge, ollama) still runs fully. The bot
# just waits. Add the token to .env and `docker compose up -d` to start it.
set -e
cd /app/bot
# The bot needs all three to log in AND register slash commands. If any is
# missing, wait instead of crash-looping (config.ts throws on a missing var).
if [ -z "${DISCORD_BOT_TOKEN:-}" ] || [ -z "${DISCORD_APP_ID:-}" ] || [ -z "${DISCORD_GUILD_ID:-}" ]; then
echo "[bot] DISCORD_BOT_TOKEN/DISCORD_APP_ID/DISCORD_GUILD_ID 중 일부 미설정 — 봇 대기 중."
echo "[bot] .env에 셋 다 넣고 'docker compose up -d' 하면 시작됩니다."
echo "[bot] (그동안 VNC 데스크톱 / 브릿지 / Ollama 는 정상 동작합니다.)"
exec sleep infinity
fi
BRIDGE="${BRIDGE_URL:-http://127.0.0.1:8765}"
for i in $(seq 1 60); do
curl -fsS "$BRIDGE/health" >/dev/null 2>&1 && break
sleep 1
done
bun run register || echo "[bot] slash command registration failed (continuing)"
exec bun run start