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
热度 56.07
最近更新 2026-05-11 17:28:34
分类:协作依赖:代码执行 / 第三方 API / 读写文件应用场景:API 集成 / 自动化脚本 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add 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