360 Secure SkillHub
360 安全技能中心

Discord Bridge

通过 Python 脚本运行 Discord 机器人,监听 Discord 消息事件,按允许的频道 ID 和命令前缀过滤后,把消息转发到 Agent Zero 的 api_message 接口,实现 Discord 用户与 Agent 的交互。依赖 discord.py、aiohttp 与 python-dotenv,需配置 Discord 机器人令牌与 Agent Zero API 密钥。

分类:协作
wespeakallday
wespeakallday
热度 41.71
最近更新 2026-05-11 17:28:34

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add wespeakallday/discord-bridge
兼容性
通用兼容
联网要求
需要联网
数据出网
必须出网
Metadata
name
discord-bridge
description
Bridge Discord messages to Agent Zero's HTTP API
version
1.0.1
author
Migration from Agent Zero

Discord Bridge Skill

Overview

Bridges Discord messages to Agent Zero's api_message HTTP endpoint, enabling Discord users to interact with Agent Zero agents.

Purpose

  • Forward Discord messages from specific channels to Agent Zero
  • Handle async Discord bot events
  • Support command prefix filtering
  • Session-based message bridging

Input Variables

Variable Description Example
{{DISCORD_BOT_TOKEN}} Discord bot authentication token Bot token from Discord Developer Portal
{{A0_API_URL}} Agent Zero API endpoint http://localhost:80/api_message
{{A0_API_KEY}} Agent Zero API authentication mcp_server_token from settings
{{DISCORD_CHANNEL_IDS}} Comma-separated allowed channel IDs "123456789,987654321"
{{BOT_CMD_PREFIX}} Command prefix for bot commands "!"

Triggers

  • Discord on_message event
  • Filtered by ALLOWED_CHANNEL_SET (if configured)
  • Messages containing command prefix for special handling

APIs & Dependencies

  • discord.py: Discord bot framework
  • aiohttp: Async HTTP client for API calls
  • python-dotenv: Environment variable management

Files

  • index.py - Main Discord bot logic
  • .env.example - Environment template

Usage

# Install dependencies
pip install discord.py aiohttp python-dotenv

# Configure environment
cp .env.example .env
# Edit .env with your credentials

# Run the bridge
python index.py