介绍
# Discord Actions
## 概述
使用 `discord` 管理消息、回应、线程、投票和审核。你可以通过 `discord.actions.*` 禁用功能组(默认启用,但角色/审核除外)。该工具使用为 Clawdbot 配置的机器人令牌。
## 需要收集的输入
- 对于回应:`channelId`、`messageId` 和一个 `emoji`。 - 对于贴纸/投票/发送消息:`to` 目标(`channel:<id>` 或 `user:<id>`)。可选 `content` 文本。 - 投票还需要一个 `question`(问题)和 2–10 个 `answers`(答案)。 - 对于媒体:`mediaUrl`,本地文件使用 `file:///path`,远程文件使用 `https://...`。 - 对于表情上传:`guildId`、`name`、`mediaUrl`,可选 `roleIds`(限制 256KB,PNG/JPG/GIF)。 - 对于贴纸上传:`guildId`、`name`、`description`、`tags`、`mediaUrl`(限制 512KB,PNG/APNG/Lottie JSON)。
消息上下文行包含 `discord message id` 和 `channel` 字段,你可以直接重用。
**注意:** `sendMessage` 使用 `to: "channel:<id>"` 格式,而不是 `channelId`。其他操作如 `react`、`readMessages`、`editMessage` 直接使用 `channelId`。
## 操作
### 对消息进行回应
```json { "action": "react", "channelId": "123", "messageId": "456", "emoji": "✅" } ```
### 列出回应 + 用户
```json { "action": "reactions", "channelId": "123", "messageId": "456", "limit": 100 } ```
### 发送贴纸
```json { "action": "sticker", "to": "channel:123", "stickerIds": ["9876543210"], "content": "Nice work!" } ```
- 每条消息最多 3 个贴纸 ID。 - `to` 可以是 `user:<id>` 用于私信。
### 上传自定义表情
```json { "action": "emojiUpload", "guildId": "999", "name": "party_blob", "mediaUrl": "file:///tmp/party.png", "roleIds": ["222"] } ```
- 表情图片必须是 PNG/JPG/GIF 且 <= 256KB。 - `roleIds` 是可选的;省略则所有人可用。
### 上传贴纸
```json { "action": "stickerUpload", "guildId": "999", "name": "clawdbot_wave", "description": "Clawdbot waving hello", "tags": "👋", "mediaUrl": "file:///tmp/wave.png" } ```
- 贴纸需要 `name`、`description` 和 `tags`。 - 上传文件必须是 PNG/APNG/Lottie JSON 且 <= 512KB。
### 创建投票
```json { "action": "poll", "to": "channel:123", "question": "Lunch?", "answers": ["Pizza", "Sushi", "Salad"], "allowMultiselect": false, "durationHours": 24, "content": "Vote now" } ```
- `durationHours` 默认为 24;最长 32 天(768 小时)。
### 检查频道的机器人权限
```json { "action": "permissions", "channelId": "123" } ```
## 尝试的想法
- 使用 ✅/⚠️ 回应以标记状态更新。 - 发布针对发布决策或会议时间的快速投票。 - 成功部署后发送庆祝贴纸。 - 为发布时刻上传新表情/贴纸。 - 在团队频道中运行每周“优先级检查”投票。 - 当用户的请求完成后,发送贴纸私信作为确认。
## 操作限制
使用 `discord.actions.*` 禁用操作组: - `reactions`(回应 + 回应列表 + emojiList) - `stickers`、`polls`、`permissions`、`messages`、`threads`、`pins`、`search` - `emojiUploads`、`stickerUploads` - `memberInfo`、`roleInfo`、`channelInfo`、`voiceStatus`、`events` - `roles`(角色添加/移除,默认 `false`) - `moderation`(超时/踢出/封禁,默认 `false`)
### 读取最近的消息
```json { "action": "readMessages", "channelId": "123", "limit": 20 } ```
### 发送/编辑/删除消息
```json { "action": "sendMessage", "to": "channel:123", "content": "Hello from Clawdbot" } ```
**附带媒体附件:**
```json { "action": "sendMessage", "to": "channel:123", "content": "Check out this audio!", "mediaUrl": "file:///tmp/audio.mp3" } ```
- `to` 使用格式 `channel:<id>` 或 `user:<id>` 用于私信(不是 `channelId`!) - `mediaUrl` 支持本地文件(`file:///path/to/file`)和远程 URL(`https://...`) - 可选 `replyTo` 配合消息 ID 以回复特定消息
```json { "action": "editMessage", "channelId": "123", "messageId": "456", "content": "Fixed typo" } ```
```json { "action": "deleteMessage", "channelId": "123", "messageId": "456" } ```
### 线程
```json { "action": "threadCreate", "channelId": "123", "name": "Bug triage", "messageId": "456" } ```
```json { "action": "threadList", "guildId": "999" } ```
```json { "action": "threadReply", "channelId": "777", "content": "Replying in thread" } ```
### 置顶消息
```json { "action": "pinMessage", "channelId": "123", "messageId": "456" } ```
```json { "action": "listPins", "channelId": "123" } ```
### 搜索消息
```json { "action": "searchMessages", "guildId": "999", "content": "release notes", "channelIds": ["123", "456"], "limit": 10 } ```
### 成员 + 角色信息
```json { "action": "memberInfo", "guildId": "999", "userId": "111" } ```
```json { "action": "roleInfo", "guildId": "999" } ```
### 列出可用的自定义表情
```json { "action": "emojiList", "guildId": "999" } ```
### 角色更改(默认禁用)
```json { "action": "roleAdd", "guildId": "999", "userId": "111", "roleId": "222" } ```
### 频道信息
```json { "action": "channelInfo", "channelId": "123" } ```
```json { "action": "channelList", "guildId": "999" } ```
### 语音状态
```json { "action": "voiceStatus", "guildId": "999", "userId": "111" } ```
### 计划事件
```json { "action": "eventList", "guildId": "999" } ```
### 审核操作(默认禁用)
```json { "action": "timeout", "guildId": "999", "userId": "111", "durationMinutes": 10 } ```
## Discord 写作风格指南
**保持对话感!** Discord 是一个聊天平台,不是文档。
### 要做 - 短小、有力的消息(理想情况下 1-3 句话) - 多个快速回复 > 一大段文字 - 使用表情符号表达语气/强调 🦞 - 小写随意风格即可 - 将信息分解为易于消化的块 - 匹配对话的能量
### 不要做 - 不要 Markdown 表格(Discord 会将其渲染为丑陋的原始 `| text |`) - 不要在随意聊天中使用 `## 标题`(使用 **粗体** 或全大写进行强调) - 避免多段落的长篇大论 - 不要过度解释简单的事情 - 跳过“我很乐意为您提供帮助!”之类的客套话
### 有效的格式 - **粗体** 用于强调 - `代码` 用于技术术语 - 列表用于多个项目 - > 引用用于参考 - 将多个链接包裹在 `<>` 中以抑制嵌入预览
### 转换示例
❌ 差: ``` I'd be happy to help with that! Here's a comprehensive overview of the versioning strategies available:
## Semantic Versioning Semver uses MAJOR.MINOR.PATCH format where...
## Calendar Versioning CalVer uses date-based versions like... ```
✅ 好: ``` versioning options: semver (1.2.3), calver (2026.01.04), or yolo (`latest` forever). what fits your release cadence? ```