@zhin.js/adapter-discord 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/README.md +7 -8
  3. package/adapters/{discord.js → discord/index.js} +6 -6
  4. package/adapters/{discord.ts → discord/index.ts} +9 -9
  5. package/agents/discord/agent.json +20 -0
  6. package/agents/discord/boundaries.md +3 -0
  7. package/agents/discord/conventions.md +3 -0
  8. package/agents/discord/skills/discord/SKILL.md +21 -0
  9. package/agents/discord/skills/discord/tools/add_role/index.js +24 -0
  10. package/{agent/tools/add_role.ts → agents/discord/skills/discord/tools/add_role/index.ts} +4 -4
  11. package/agents/discord/skills/discord/tools/create_thread/index.js +29 -0
  12. package/{agent/tools/create_thread.ts → agents/discord/skills/discord/tools/create_thread/index.ts} +4 -4
  13. package/agents/discord/skills/discord/tools/forum_post/index.js +33 -0
  14. package/{agent/tools/forum_post.ts → agents/discord/skills/discord/tools/forum_post/index.ts} +2 -2
  15. package/agents/discord/skills/discord/tools/list_roles/index.js +28 -0
  16. package/{agent/tools/list_roles.ts → agents/discord/skills/discord/tools/list_roles/index.ts} +4 -4
  17. package/agents/discord/skills/discord/tools/react/index.js +24 -0
  18. package/{agent/tools/react.ts → agents/discord/skills/discord/tools/react/index.ts} +2 -2
  19. package/agents/discord/skills/discord/tools/remove_role/index.js +24 -0
  20. package/{agent/tools/remove_role.ts → agents/discord/skills/discord/tools/remove_role/index.ts} +4 -4
  21. package/agents/discord/skills/discord/tools/send_embed/index.js +43 -0
  22. package/{agent/tools/send_embed.ts → agents/discord/skills/discord/tools/send_embed/index.ts} +2 -2
  23. package/agents/discord/system.md +3 -0
  24. package/commands/{endpoint/add/[id].js → discord/endpoint/add/[id]/index.js} +1 -1
  25. package/commands/discord/endpoint/add/[id]/index.ts +3 -0
  26. package/{lib/discord-endpoint-commands.js → commands/discord/endpoint/definition.js} +5 -4
  27. package/{src/discord-endpoint-commands.ts → commands/discord/endpoint/definition.ts} +4 -4
  28. package/commands/{endpoint/list.js → discord/endpoint/list/index.js} +1 -1
  29. package/commands/discord/endpoint/list/index.ts +3 -0
  30. package/commands/{endpoint/remove/[id].js → discord/endpoint/remove/[id]/index.js} +1 -1
  31. package/commands/discord/endpoint/remove/[id]/index.ts +3 -0
  32. package/lib/discord-runtime-state.js +1 -1
  33. package/lib/index.d.ts +2 -2
  34. package/lib/index.js +1 -1
  35. package/lib/protocol.d.ts +15 -32
  36. package/lib/protocol.js +20 -33
  37. package/package.json +32 -21
  38. package/schema.json +66 -2
  39. package/src/discord-runtime-state.ts +1 -1
  40. package/src/index.ts +3 -1
  41. package/src/protocol.ts +37 -64
  42. package/agent/skills/discord.md +0 -104
  43. package/commands/endpoint/add/[id].ts +0 -3
  44. package/commands/endpoint/list.ts +0 -3
  45. package/commands/endpoint/remove/[id].ts +0 -3
  46. package/lib/discord-endpoint-commands.d.ts +0 -1
  47. /package/{agent/PERMITS.md → PERMITS.md} +0 -0
@@ -1,104 +0,0 @@
1
- ---
2
- name: discord
3
- platforms:
4
- - discord
5
- description: >-
6
- Discord 服务器全功能管理。当用户在 Discord 中请求群管(踢人、封禁、解封、禁言、改昵称)、
7
- 角色管理(授予/移除/查看角色)、内容管理(线程创建、论坛帖子、Embed 富文本、表情反应)、
8
- 或查询成员/服务器信息时使用。即使用户没有提到 Discord,只要上下文是 Discord 场景
9
- 且涉及上述操作,就应触发。仅有用户名时必须先 list_members 获取 user ID。
10
- keywords:
11
- - discord
12
- - adapter:discord
13
- - 群管理
14
- - 踢人
15
- - 禁言
16
- - 封禁
17
- - 角色
18
- - 线程
19
- - embed
20
- - 反应
21
- - 论坛
22
- - list_members
23
- tags:
24
- - group
25
- - management
26
- - im
27
- tools:
28
- - discord_add_role
29
- - discord_remove_role
30
- - discord_list_roles
31
- - discord_create_thread
32
- - discord_react
33
- - discord_send_embed
34
- - discord_forum_post
35
- - discord_kick_member
36
- - discord_ban_member
37
- - discord_unban_member
38
- - discord_mute_member
39
- - discord_set_nickname
40
- - discord_list_members
41
- - discord_get_group_info
42
- ---
43
-
44
- # Discord 服务器管理技能
45
-
46
- Discord 的管理模型围绕「角色」和「权限」展开,与 QQ 的 admin/member 模型不同。
47
-
48
- ## 核心原则
49
-
50
- ### ID 获取链
51
-
52
- Discord 操作需要精确的 ID(用户 ID、角色 ID)。两步获取:
53
- - **用户 ID**:`discord_list_members` → 匹配昵称
54
- - **角色 ID**:`discord_list_roles` → 匹配角色名
55
-
56
- **Example:**
57
- ```
58
- 用户: 给小明加个"管理员"角色
59
- 步骤1: discord_list_members → 找到小明的 user_id
60
- 步骤2: discord_list_roles → 找到"管理员"角色的 role_id
61
- 步骤3: discord_add_role(user_id, role_id)
62
- ```
63
-
64
- ### 角色优先思维
65
-
66
- Discord 中几乎所有权限都由角色控制。用户说「给他管理员」不一定是设管理员,可能是授予某个有管理权限的角色。理解用户意图后选择正确的工具。
67
-
68
- ## 工具分类
69
-
70
- ### 成员管理
71
-
72
- | 工具 | 用途 | 说明 |
73
- |------|------|------|
74
- | `discord_kick_member` | 踢出成员 | 被踢后可通过邀请重新加入 |
75
- | `discord_ban_member` | 封禁 | 阻止重新加入 + 可选删除历史消息 |
76
- | `discord_unban_member` | 解除封禁 | — |
77
- | `discord_mute_member` | 禁言 | — |
78
- | `discord_set_nickname` | 改昵称 | 服务器内昵称,非全局 |
79
- | `discord_list_members` | 成员列表 | — |
80
- | `discord_get_group_info` | 服务器/频道信息 | — |
81
-
82
- ### 角色管理
83
-
84
- | 工具 | 用途 | 说明 |
85
- |------|------|------|
86
- | `discord_add_role` | 授予角色 | 需 role_id |
87
- | `discord_remove_role` | 移除角色 | 需 role_id |
88
- | `discord_list_roles` | 角色列表 | 获取所有角色及其 ID |
89
-
90
- ### 内容与互动
91
-
92
- | 工具 | 用途 | 说明 |
93
- |------|------|------|
94
- | `discord_create_thread` | 创建线程 | 从消息或频道创建讨论线程 |
95
- | `discord_react` | 表情反应 | 支持 Unicode emoji 和自定义 emoji |
96
- | `discord_send_embed` | Embed 富文本 | title/description/color/fields 等字段 |
97
- | `discord_forum_post` | 论坛帖子 | 在论坛频道发布帖子 |
98
-
99
- ## 易错点
100
-
101
- 1. **Discord 昵称是服务器级别的**,一个用户在不同服务器可以有不同昵称。
102
- 2. **角色操作需要角色 ID**,不能用角色名直接操作。先 `list_roles` 查。
103
- 3. **Embed 消息不是普通文本**,它有固定结构(title/description/color/fields),用于发送富文本格式的消息。
104
- 4. **Bot 只能操作低于自身角色的成员**。如果目标用户的最高角色高于 Endpoint 的角色,操作会失败。
@@ -1,3 +0,0 @@
1
- import { discordEndpointCommands } from '../../../src/discord-endpoint-commands.js';
2
-
3
- export default discordEndpointCommands.add;
@@ -1,3 +0,0 @@
1
- import { discordEndpointCommands } from '../../src/discord-endpoint-commands.js';
2
-
3
- export default discordEndpointCommands.list;
@@ -1,3 +0,0 @@
1
- import { discordEndpointCommands } from '../../../src/discord-endpoint-commands.js';
2
-
3
- export default discordEndpointCommands.remove;
@@ -1 +0,0 @@
1
- export declare const discordEndpointCommands: import("@zhin.js/adapter").EndpointCommands<Readonly<import("@zhin.js/command").CommandDefinition<unknown, unknown, import("@zhin.js/command").CommandMessage, string | undefined>>>;
File without changes