Discord消息操作Skill discord

这是一个用于通过标准化消息工具与Discord平台进行交互的技能。它允许智能体在Discord服务器和频道中执行发送消息、管理消息(编辑、删除、置顶、添加反应)、创建线程、发起投票、搜索消息以及设置在线状态等一系列操作。该技能严格遵循Discord API的调用规范,强调使用组件v2构建现代交互界面,并提供了详细的权限控制和多账户支持指南。关键词:Discord API,消息机器人,社群管理,自动化操作,组件交互。

DevOps 0 次安装 10 次浏览 更新于 2/24/2026

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.*(部分默认关闭:rolesmoderationpresencechannels)。
  • 优先使用明确的ID:guildIdchannelIdmessageIduserId
  • 多账户:可选的 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等)。
  • 不要将 componentsembeds 结合使用(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> 来提及用户。