日本語対応のDiscord AIボイスボット - Go実装
Translation pending
SocialTypeScript · JavaScriptGitHub @g-kariOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
No updates detected yet. GitHub releases will appear here.
Owners of public repositories under a personal GitHub account can sign in to verify ownership and manage the introduction themselves. No administrator approval is needed.
Sign in, generate a verification file, and commit it to this repository’s default branch within 30 minutes. Files on other branches or forks do not count. Then check the file below to manage the project without administrator approval. Keep the file to retain your access.
If needed, you will go to sign-in. After signing in, return here and press your chosen verification button again.
Run /nomorevibe verify in your project folder to verify ownership and manage the introduction yourself.
Verify in one minuteAsk about other verification options
Loading the full README. The saved excerpt is shown below.
2026-10-02: Cloudflare向けの共通つむぎTTS・読み上げBotを開発中です。 新構成は apps/voice/ と deploy/cloudflare/ にあり、構成・移行・検証ゲートを参照してください。 停止設定のCloudflare反映と、指定サーバーへの5コマンド登録・読み戻しは確認済みです。 2026-10-03の短時間試験で、HTTPコマンドからのGateway/VC接続と実際の読み上げを確認しました。試験は終了し、両Containerは停止・上限0です。 話者名の読み上げ・/model での声変更は開発中・未反映です。音質の問題は別途確認が必要です。以下は旧Go版の説明です。 このプロジェクトは、Go言語で実装された高性能なDiscord AI音声ボットです。 リアルタイムの音声認識(STT)、大規模言語モデル(LLM)、高品質な音声合成(TTS)を統合し、Discordのボイスチャンネルで自然な日本語会話を実現します。Read the full README ↗
2026-10-02: Cloudflare向けの共通つむぎTTS・読み上げBotを開発中です。 新構成は
apps/voice/とdeploy/cloudflare/にあり、構成・移行・検証ゲートを参照してください。 停止設定のCloudflare反映と、指定サーバーへの5コマンド登録・読み戻しは確認済みです。 2026-10-03の短時間試験で、HTTPコマンドからのGateway/VC接続と実際の読み上げを確認しました。試験は終了し、両Containerは停止・上限0です。 話者名の読み上げ・/modelでの声変更は開発中・未反映です。音質の問題は別途確認が必要です。以下は旧Go版の説明です。
このプロジェクトは、Go言語で実装された高性能なDiscord AI音声ボットです。 リアルタイムの音声認識(STT)、大規模言語モデル(LLM)、高品質な音声合成(TTS)を統合し、Discordのボイスチャンネルで自然な日本語会話を実現します。
src/bot-go/
├── cmd/bot/ # メインエントリーポイント
├── internal/ # 内部パッケージ
│ ├── ai/ # AI サービス (Whisper, LLM, TTS, Vision)
│ ├── bot/ # ボットコアロジックとハンドラー
│ ├── config/ # 設定管理
│ └── voice/ # 音声録音とVADシステム
├── .air.toml # Air設定ファイル
├── .env.example # 環境変数テンプレート
├── go.mod # Go依存関係
└── start_watch.sh # 開発用スクリプト
このボットは以下の処理フローで動作します:
Discord音声 → UDPパケット → RTP解析 → Opus抽出 → VAD解析
↓
音声検出 → 録音開始 → Opusパケットバッファ → 無音検出
↓
録音停止 → Opusデコード(gopus) → PCM組み立て → WAV生成
↓
go-whisper API → 日本語音声認識 → テキスト出力
認識テキスト → LLM処理(Ollama/Dify) → AI応答生成
↓
AivisSpeech TTS → 音声合成 → Discordボイスチャンネル再生
# Go 1.21+ が必要
go version
# プロジェクトのクローン
git clone https://github.com/g-kari/discord-friend.git
cd discord-friend/src/bot-go
# Go モジュールの依存関係をインストール
go mod download
# システム依存関係(Ubuntu/Debian)
sudo apt-get install libopus-dev
# システム依存関係(macOS)
brew install opus
# 環境変数ファイルをコピー
cp .env.example .env
# .env ファイルを編集(必須項目を設定)
# Discord
DISCORD_BOT_TOKEN=your_discord_bot_token
# AI Services
PREFER_LOCAL_LLM=true
OLLAMA_API_URL=http://localhost:11434
OPENAI_API_KEY=your_openai_key # 音声認識用
# Voice Services
AIVISSPEECH_API_URL=http://localhost:50021
WHISPER_API_URL=http://localhost:8080
# Bot Settings
DEFAULT_RECORDING_DURATION=10
LOG_LEVEL=INFO
# 1. AivisSpeech (VOICEVOX) を起動
docker run -p 50021:50021 voicevox/voicevox_engine:latest
# 2. Ollama を起動(ローカルLLM用)
ollama serve
ollama pull qwen2.5:7b # 日本語モデル
# 3. go-whisper を起動(音声認識用)
# 詳細: https://github.com/mutablelogic/go-whisper
# 開発モード(自動リロード)
./start_watch.sh
# 直接実行
go run cmd/bot/main.go
# ビルドして実行
go build -o discord-bot cmd/bot/main.go
./discord-bot
/join - ボイスチャンネルに参加(VAD自動開始)/leave - ボイスチャンネルから退出/record - 手動音声録音(10秒間)/listen - Voice Activity Detection の開始/停止/screenshot - スクリーンショット撮影・解析/screen_share - スクリーン共有解析の開始/停止/ping - ボットの状態確認cd src/bot-go
# 依存関係のインストール
go mod download
# ホットリロード開発サーバー
./start_watch.sh
# 直接実行
go run cmd/bot/main.go
# ビルド
go build -o discord-bot cmd/bot/main.go
# テスト実行
go test ./...
# コードフォーマット
go fmt ./...
# リント(golangci-lintが必要)
golangci-lint run
./start_watch.sh で自動リロードlogs/bot.log で詳細デバッグ/join で参加後、話すかけるか /record で手動録音# 最近の音声関連ログを確認
tail -100 logs/bot.log | grep -E "(VOICE|OPUS|WAV|WHISPER|VAD)"
# リアルタイムログ監視
tail -f logs/bot.log
# エラーパターンの確認
grep -n "ERROR\|FAILED\|❌" logs/bot.log | tail -20
# VAD統計の分析
grep "VAD Statistics" logs/bot.log
.env ファイルに設定(リポジトリにコミットしない)logs/bot.log にパケットレベルの詳細デバッグ情報/join コマンドでボイスチャンネルに参加してから話す⚠️ 重要: APIキーなどの機密情報をリポジトリにコミットしないでください。
# Git 履歴の機密情報チェック
python scripts/check_git_secrets.py
# pre-commit フックの設定
ln -sf ../../scripts/pre-commit.sh .git/hooks/pre-commit
.env ファイルに保存.gitignore 設定: .env ファイルをGit管理対象外に.env.example にはサンプル値のみ詳細は scripts/README.md を参照してください。
このプロジェクトは複数のオープンソースライブラリを使用しています:
プロジェクトへの貢献を歓迎します!
詳細な貢献方法については CLAUDE.md の「Git Commit Guidelines」を参照してください。