github organisationのためのbot
- 環境変数テンプレートをコピー:
cp .env.sample .env.envを編集し、各種トークンや設定を記入:
DISCORD_TOKEN=your_discord_bot_token_here
GEMINI_API_KEY=your_gemini_api_key_here
GITHUB_TOKEN=your_github_token_here
GITHUB_ORGANIZATION=your-organization-name
DISCORD_GUILD_ID=123456789012345678
DISCORD_CATEGORY_ID=123456789012345678ビルドと起動:
docker compose up --buildservices:
bot:
# ...既存の設定...
ports:
- "8035:8000" # ← 例: ホスト8035→コンテナ8000.env で WEBHOOK_PORT を指定している場合は、
"8035:8000" の「右側」を .env の WEBHOOK_PORT に合わせてください。
- Payload URL:
http://<サーバのIPまたはドメイン>:8000/webhook/github - Content type:
application/json - Events: Send me everything
GitHubのorganizationリポジトリとDiscordチャンネルを同期するモジュール
機能:
- GitHubリポジトリの自動検出
- 対応するDiscordチャンネルの作成・更新
- スラッシュコマンド (
/sync-repos,/list-repos) - 定期実行スクリプト
詳細: src/synk_channel/README.md
GitHubのissue/PRとDiscordチャンネルのコメントを双方向同期するモジュール
機能:
- GitHub webhook受信とDiscord通知
- Discord→GitHubへのコメント投稿
- ユーザー・チャンネルの紐づけ管理
- 自動スレッド作成
/sync-repos- GitHubリポジトリとDiscordチャンネルを手動同期(管理者のみ)/list-repos- Organization内のリポジトリ一覧を表示
/link_user <github_username> [discord_user]- GitHubユーザーとDiscordユーザーを紐づけ/link_channel <repo_name> [channel]- GitHubリポジトリとDiscordチャンネルを紐づけ/auto_link- チャンネル名とリポジトリ名に基づいて自動で紐づけ/connector_status- Comment Connectorの設定状況を確認/unlink_user <github_username>- GitHubユーザーとDiscordユーザーの紐づけを解除/unlink_channel <repo_name>- GitHubリポジトリとDiscordチャンネルの紐づけを解除
/sync-reposでDiscordチャンネルを作成/auto_linkでチャンネルとリポジトリを一括紐づけ- GitHubのorganization設定でwebhookを設定
- GitHub上のissue/PRの作成・コメントがDiscordに自動通知される
- Discordスレッド内でbotをメンション(@bot)してコメントすると、GitHubにコメントが投稿される
src/main.py- Main bot entry pointsrc/config.py- Configuration loading from environment variablessrc/synk_channel/- GitHub repository sync modulescripts/sync_repositories.py- Scheduled sync scriptpyproject.toml- Poetry project configuration and dependenciesDockerfile- Container build configurationdocker-compose.yaml- Multi-service deployment with VoiceVox
新しいモジュールを追加する場合は、src/main.py にインポートし、setup関数を呼び出してください:
from your_module import your_module as module_bot
module_bot.setup(tree, client)- v2系では
docker compose(スペースあり)コマンドを使用してください。 - v1系の
docker-compose(ハイフンあり)は非推奨です。 - 詳細は公式ドキュメントを参照してください。