用途
Discord Notify 用于通过 Discord 的传入 Webhook(incoming webhook)向 Discord 频道发送消息和通知。当你需要向 Discord 频道发布告警、更新或消息,但又不想搭建完整机器人(bot)时,可以使用该技能。
主要能力
- 纯文本消息
- 带字段的富文本嵌入(embeds)
- 用户提及(
<@USER_ID>) - 角色提及(
<@&ROLE_ID>) - 时间戳
- 彩色嵌入
- 缩略图和图片
使用方式
配置
- 在 Discord 中进入 频道设置 → 集成(Integrations)→ Webhook
- 创建一个新的 Webhook 并复制其 URL
- 将其设置为 GitHub 密钥:
AGENT_LLM_DISCORD_WEBHOOK_URL
调用示例
const { sendDiscordMessage } = require('./index.js');
// 简单消息
await sendDiscordMessage('Hello from PopeBot!');
// 富文本嵌入
await sendDiscordMessage('', {
embeds: [{
title: 'Job Complete',
description: 'The task finished successfully',
color: 0x00ff00,
fields: [
{ name: 'Duration', value: '5 minutes', inline: true },
{ name: 'Status', value: 'Success', inline: true }
],
timestamp: new Date().toISOString()
}]
});
// 带提及
await sendDiscordMessage('Task done <@123456789>!');
速率限制
Discord Webhook 的速率限制约为每分钟 30 次请求。该技能内置了自动重试逻辑。
适用场景与限制
适用于需要向 Discord 频道推送告警、任务完成通知、状态更新等场景,且无需完整 bot 的场合。使用前必须先在 Discord 创建 Webhook 并配置对应的 GitHub 密钥。受 Discord Webhook 速率限制影响,高频发送时依赖内置重试逻辑。其余关于收费、价格、平台支持范围等信息暂未提供。