name: discord description: “通过消息工具进行Discord操作(channel=discord)。” metadata: { “openclaw”: { “emoji”: “🎮”, “requires”: { “config”: [“channels.discord.token”] } } } allowed-tools: [“message”]
Discord(通过 message 工具)
使用 message 工具。没有向智能体暴露特定于提供商的 discord 工具。
必须遵守的规则
- 始终:
channel: "discord"。 - 尊重权限控制:
channels.discord.actions.*(部分默认关闭:roles、moderation、presence、channels)。 - 优先使用明确的ID:
guildId、channelId、messageId、userId。 - 多账户:可选的
accountId。
指导原则
- 避免在发送到Discord的消息中使用Markdown表格。
- 使用
<@用户_ID>来提及用户。 - 对于丰富的UI,优先使用Discord组件v2(
components);仅在必要时使用传统的embeds。
目标
- 发送类操作:
to: "channel:<id>"或to: "user:<id>"。 - 消息特定操作:
channelId: "<id>"(或to)+messageId: "<id>"。
常见操作(示例)
发送消息:
{
"action": "send",
"channel": "discord",
"to": "channel:123",
"message": "hello",
"silent": true
}
发送带媒体的消息:
{
"action": "send",
"channel": "discord",
"to": "channel:123",
"message": "see attachment",
"media": "file:///tmp/example.png"
}
- 可选的
silent: true可以抑制Discord通知。
发送带组件v2的消息(推荐用于丰富UI):
{
"action": "send",
"channel": "discord",
"to": "channel:123",
"message": "Status update",
"components": "[Carbon v2 components]"
}
components期望来自JS/TS集成的Carbon组件实例(Container、TextDisplay等)。- 不要将
components与embeds结合使用(Discord会拒绝v2组件+embeds)。
传统嵌入(不推荐):
{
"action": "send",
"channel": "discord",
"to": "channel:123",
"message": "Status update",
"embeds": [{ "title": "Legacy", "description": "Embeds are legacy." }]
}
- 当存在组件v2时,
embeds会被忽略。
添加反应:
{
"action": "react",
"channel": "discord",
"channelId": "123",
"messageId": "456",
"emoji": "✅"
}
读取消息:
{
"action": "read",
"channel": "discord",
"to": "channel:123",
"limit": 20
}
编辑 / 删除:
{
"action": "edit",
"channel": "discord",
"channelId": "123",
"messageId": "456",
"message": "fixed typo"
}
{
"action": "delete",
"channel": "discord",
"channelId": "123",
"messageId": "456"
}
发起投票:
{
"action": "poll",
"channel": "discord",
"to": "channel:123",
"pollQuestion": "Lunch?",
"pollOption": ["Pizza", "Sushi", "Salad"],
"pollMulti": false,
"pollDurationHours": 24
}
置顶消息:
{
"action": "pin",
"channel": "discord",
"channelId": "123",
"messageId": "456"
}
创建线程:
{
"action": "thread-create",
"channel": "discord",
"channelId": "123",
"messageId": "456",
"threadName": "bug triage"
}
搜索消息:
{
"action": "search",
"channel": "discord",
"guildId": "999",
"query": "release notes",
"channelIds": ["123", "456"],
"limit": 10
}
设置状态(通常受权限控制):
{
"action": "set-presence",
"channel": "discord",
"activityType": "playing",
"activityName": "with fire",
"status": "online"
}
写作风格(Discord)
- 简短、对话式、不拘礼节。
- 不使用Markdown表格。
- 使用
<@用户_ID>来提及用户。