@zhin.js/adapter-qq 8.0.0 → 8.0.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.
- package/CHANGELOG.md +31 -0
- package/README.md +10 -1
- package/adapters/qq.js +0 -7
- package/adapters/qq.ts +0 -7
- package/agent/tools/add_role.ts +5 -7
- package/agent/tools/channel_info.ts +5 -7
- package/agent/tools/create_role.ts +5 -7
- package/agent/tools/list_channels.ts +5 -7
- package/agent/tools/list_guilds.ts +6 -9
- package/agent/tools/list_roles.ts +5 -7
- package/agent/tools/member_detail.ts +5 -7
- package/agent/tools/remove_role.ts +5 -7
- package/lib/client.d.ts +12 -0
- package/lib/client.js +2 -0
- package/lib/endpoint.d.ts +8 -26
- package/lib/endpoint.js +43 -68
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/qq-endpoint-commands.d.ts +1 -1
- package/lib/side-event-dispatch.d.ts +2 -2
- package/lib/side-event-dispatch.js +3 -3
- package/package.json +16 -15
- package/src/client.ts +16 -0
- package/src/endpoint.ts +50 -97
- package/src/index.ts +1 -7
- package/src/side-event-dispatch.ts +4 -4
- package/lib/qq-agent-deps.d.ts +0 -21
- package/lib/qq-agent-deps.js +0 -30
- package/src/qq-agent-deps.ts +0 -60
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @zhin.js/adapter-qq
|
|
2
2
|
|
|
3
|
+
## 8.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [736fa04]
|
|
8
|
+
- @zhin.js/agent@1.1.17
|
|
9
|
+
- zhin.js@6.0.14
|
|
10
|
+
|
|
11
|
+
## 8.0.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 1fc78bc: Unify native platform Client access behind the literal `adapter` discriminant. Handlers infer both native events and Clients, while command, inbound/outbound middleware, and both Agent tool authoring surfaces expose the exact operation-scoped Client through a lazy `$client` getter. Definitions without `adapter` keep `$client` typed as `unknown`, and runtime dispatch rejects adapter mismatches before resolving the Client. Bundled platform tools now use this single path instead of model-provided endpoint ids and adapter-specific dependency wrappers. Every adapter registers one Client/EventMap contract, and protocol adapters including NapCat, Milky, OneBot and Satori now produce transport-independent Client objects rather than letting Endpoint instances impersonate Clients.
|
|
16
|
+
- Updated dependencies [e9c6a73]
|
|
17
|
+
- Updated dependencies [4e8117c]
|
|
18
|
+
- Updated dependencies [902fa35]
|
|
19
|
+
- Updated dependencies [54bfd6b]
|
|
20
|
+
- Updated dependencies [12025ee]
|
|
21
|
+
- Updated dependencies [09b14d6]
|
|
22
|
+
- Updated dependencies [1fc78bc]
|
|
23
|
+
- @zhin.js/agent@1.1.16
|
|
24
|
+
- @zhin.js/adapter@1.2.1
|
|
25
|
+
- @zhin.js/core@1.5.14
|
|
26
|
+
- @zhin.js/host-http@1.0.13
|
|
27
|
+
- @zhin.js/command@1.0.16
|
|
28
|
+
- @zhin.js/logger@1.0.77
|
|
29
|
+
- @zhin.js/middleware@1.0.13
|
|
30
|
+
- zhin.js@6.0.14
|
|
31
|
+
- @zhin.js/feature-kit@1.0.13
|
|
32
|
+
- @zhin.js/permission@1.0.4
|
|
33
|
+
|
|
3
34
|
## 8.0.0
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ pnpm add @zhin.js/adapter-qq
|
|
|
20
20
|
## Plugin Runtime
|
|
21
21
|
|
|
22
22
|
- `@zhin.js/adapter` — 约定式 `adapters/qq.ts`(`defineAdapter`)
|
|
23
|
-
- `@zhin.js/core` — `
|
|
23
|
+
- `@zhin.js/core` — `Endpoint.emit(...)` 入站、`outboundMessageToken` 出站
|
|
24
24
|
- `zhin.js` — `plugin.ts`(`definePlugin`)
|
|
25
25
|
- 配置经插件 `schema.json` 落到 `plugins.<instanceKey>`
|
|
26
26
|
- **无需** `@zhin.js/host-http` / `@zhin.js/host-router`(WebSocket 路径)
|
|
@@ -144,6 +144,15 @@ Markdown + 指令按钮组。按钮值与手动输入共用同一解析入口,
|
|
|
144
144
|
不支持原生按钮的 Adapter 会在 Core 中把同一 keyboard 语义降级为编号列表,并保存数字到
|
|
145
145
|
payload 的回跳映射。图片、音频、视频和文件仍沿 canonical `MediaRef` 出站链投递。
|
|
146
146
|
|
|
147
|
+
## 故障排查
|
|
148
|
+
|
|
149
|
+
| 现象 | 排查 |
|
|
150
|
+
| --- | --- |
|
|
151
|
+
| Gateway Identify 后断线 | 检查 `botKind` 与 intents;公域机器人不要订阅受限 intent |
|
|
152
|
+
| 二维码绑定后仍离线 | 在 Console 登录待办确认结果,并检查 App ID、Secret 与 Token |
|
|
153
|
+
| Webhook 无事件 | 检查 HTTP Host、公网路径、平台回调与签名参数 |
|
|
154
|
+
| Markdown/按钮发送失败 | 检查平台模板与权限,并按 Endpoint 能力降级 |
|
|
155
|
+
|
|
147
156
|
## 许可证
|
|
148
157
|
|
|
149
158
|
MIT License
|
package/adapters/qq.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Convention entry: discover `adapters/qq.ts` → defineAdapter.
|
|
4
4
|
*/
|
|
5
5
|
import { defineAdapter } from 'zhin.js/adapter';
|
|
6
|
-
import { messageGatewayToken, sideEventGatewayToken } from '@zhin.js/core/runtime';
|
|
7
6
|
import { httpHostToken } from '@zhin.js/host-http';
|
|
8
7
|
import { QqHttpEndpoint, QqWebsocketEndpoint } from "../lib/endpoint.js";
|
|
9
8
|
import { resolveQqConfig, } from "../lib/protocol.js";
|
|
@@ -22,8 +21,6 @@ export default defineAdapter({
|
|
|
22
21
|
},
|
|
23
22
|
create(context) {
|
|
24
23
|
const config = resolveQqConfig(context.config);
|
|
25
|
-
const gateway = context.use(messageGatewayToken);
|
|
26
|
-
const sideEvents = context.use(sideEventGatewayToken);
|
|
27
24
|
// 注册到插件运行时状态(qq.endpoint list 的"运行中"数据源)
|
|
28
25
|
const state = context.use(qqRuntimeStateToken);
|
|
29
26
|
state.endpoints.set(config.id, {
|
|
@@ -35,14 +32,10 @@ export default defineAdapter({
|
|
|
35
32
|
const endpoint = config.mode === 'websocket'
|
|
36
33
|
? new QqWebsocketEndpoint({
|
|
37
34
|
id: context.id,
|
|
38
|
-
gateway,
|
|
39
|
-
sideEvents,
|
|
40
35
|
config,
|
|
41
36
|
})
|
|
42
37
|
: new QqHttpEndpoint({
|
|
43
38
|
id: context.id,
|
|
44
|
-
gateway,
|
|
45
|
-
sideEvents,
|
|
46
39
|
http: context.use(httpHostToken),
|
|
47
40
|
config,
|
|
48
41
|
});
|
package/adapters/qq.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Convention entry: discover `adapters/qq.ts` → defineAdapter.
|
|
3
3
|
*/
|
|
4
4
|
import { defineAdapter } from 'zhin.js/adapter';
|
|
5
|
-
import { messageGatewayToken, sideEventGatewayToken } from '@zhin.js/core/runtime';
|
|
6
5
|
import { httpHostToken } from '@zhin.js/host-http';
|
|
7
6
|
import { QqHttpEndpoint, QqWebsocketEndpoint } from '../src/endpoint.js';
|
|
8
7
|
import {
|
|
@@ -43,8 +42,6 @@ export default defineAdapter<QqAdapterConfig>({
|
|
|
43
42
|
},
|
|
44
43
|
create(context) {
|
|
45
44
|
const config = resolveQqConfig(context.config);
|
|
46
|
-
const gateway = context.use(messageGatewayToken);
|
|
47
|
-
const sideEvents = context.use(sideEventGatewayToken);
|
|
48
45
|
// 注册到插件运行时状态(qq.endpoint list 的"运行中"数据源)
|
|
49
46
|
const state = context.use(qqRuntimeStateToken);
|
|
50
47
|
state.endpoints.set(config.id, {
|
|
@@ -56,14 +53,10 @@ export default defineAdapter<QqAdapterConfig>({
|
|
|
56
53
|
const endpoint = config.mode === 'websocket'
|
|
57
54
|
? new QqWebsocketEndpoint({
|
|
58
55
|
id: context.id,
|
|
59
|
-
gateway,
|
|
60
|
-
sideEvents,
|
|
61
56
|
config,
|
|
62
57
|
})
|
|
63
58
|
: new QqHttpEndpoint({
|
|
64
59
|
id: context.id,
|
|
65
|
-
gateway,
|
|
66
|
-
sideEvents,
|
|
67
60
|
http: context.use(httpHostToken),
|
|
68
61
|
config,
|
|
69
62
|
});
|
package/agent/tools/add_role.ts
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { platformPermit } from '../../src/platform-permit.js';
|
|
4
|
-
import { getQqAgentDeps } from '../../src/qq-agent-deps.js';
|
|
5
4
|
|
|
6
|
-
export default defineAgentTool<{
|
|
5
|
+
export default defineAgentTool<{ guild_id: string; channel_id: string; user_id: string; role_id: string }>({
|
|
7
6
|
description: '给成员添加 QQ 频道角色',
|
|
8
7
|
inputSchema: z.object({
|
|
9
|
-
endpoint_id: z.string().describe('Endpoint 名称'),
|
|
10
8
|
guild_id: z.string().describe('频道 ID'),
|
|
11
9
|
channel_id: z.string().describe('子频道 ID'),
|
|
12
10
|
user_id: z.string().describe('用户 ID'),
|
|
13
11
|
role_id: z.string().describe('角色 ID'),
|
|
14
12
|
}),
|
|
15
|
-
|
|
13
|
+
adapter: 'qq',
|
|
16
14
|
tags: ['qq'],
|
|
17
15
|
permissions: [platformPermit('manage_roles')],
|
|
18
|
-
async execute({
|
|
19
|
-
const
|
|
20
|
-
const success = await
|
|
16
|
+
async execute({ guild_id, channel_id, user_id, role_id }: { guild_id: string; channel_id: string; user_id: string; role_id: string }, context) {
|
|
17
|
+
const client = context.$client;
|
|
18
|
+
const success = await client.addMemberRole(guild_id, channel_id, user_id, role_id);
|
|
21
19
|
return { success, message: success ? '已给成员添加角色' : '操作失败' };
|
|
22
20
|
},
|
|
23
21
|
});
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { platformPermit } from '../../src/platform-permit.js';
|
|
4
|
-
import { getQqAgentDeps } from '../../src/qq-agent-deps.js';
|
|
5
4
|
|
|
6
|
-
export default defineAgentTool<{
|
|
5
|
+
export default defineAgentTool<{ channel_id: string }>({
|
|
7
6
|
description: '获取 QQ 频道中指定子频道的详细信息',
|
|
8
7
|
inputSchema: z.object({
|
|
9
|
-
endpoint_id: z.string().describe('Endpoint 名称'),
|
|
10
8
|
channel_id: z.string().describe('子频道 ID'),
|
|
11
9
|
}),
|
|
12
|
-
|
|
10
|
+
adapter: 'qq',
|
|
13
11
|
tags: ['qq'],
|
|
14
12
|
permissions: [platformPermit('guild_admin')],
|
|
15
|
-
async execute({
|
|
16
|
-
const
|
|
17
|
-
return
|
|
13
|
+
async execute({ channel_id }: { channel_id: string }, context) {
|
|
14
|
+
const client = context.$client;
|
|
15
|
+
return client.getChannelInfo(channel_id);
|
|
18
16
|
},
|
|
19
17
|
});
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { platformPermit } from '../../src/platform-permit.js';
|
|
4
|
-
import { getQqAgentDeps } from '../../src/qq-agent-deps.js';
|
|
5
4
|
|
|
6
|
-
export default defineAgentTool<{
|
|
5
|
+
export default defineAgentTool<{ guild_id: string; name: string; color?: number }>({
|
|
7
6
|
description: '创建 QQ 频道角色',
|
|
8
7
|
inputSchema: z.object({
|
|
9
|
-
endpoint_id: z.string().describe('Endpoint 名称'),
|
|
10
8
|
guild_id: z.string().describe('频道 ID'),
|
|
11
9
|
name: z.string().describe('角色名称'),
|
|
12
10
|
color: z.number().optional().describe('颜色(RGB 十进制数值)'),
|
|
13
11
|
}),
|
|
14
|
-
|
|
12
|
+
adapter: 'qq',
|
|
15
13
|
tags: ['qq'],
|
|
16
14
|
permissions: [platformPermit('guild_owner')],
|
|
17
|
-
async execute({
|
|
18
|
-
const
|
|
19
|
-
const role = await
|
|
15
|
+
async execute({ guild_id, name, color }: { guild_id: string; name: string; color?: number }, context) {
|
|
16
|
+
const client = context.$client;
|
|
17
|
+
const role = await client.createGuildRole(guild_id, name, color);
|
|
20
18
|
return { success: !!role, role, message: role ? `角色 "${name}" 创建成功` : '创建失败' };
|
|
21
19
|
},
|
|
22
20
|
});
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { platformPermit } from '../../src/platform-permit.js';
|
|
4
|
-
import { getQqAgentDeps } from '../../src/qq-agent-deps.js';
|
|
5
4
|
|
|
6
|
-
export default defineAgentTool<{
|
|
5
|
+
export default defineAgentTool<{ guild_id: string }>({
|
|
7
6
|
description: '获取 QQ 频道下的子频道列表',
|
|
8
7
|
inputSchema: z.object({
|
|
9
|
-
endpoint_id: z.string().describe('Endpoint 名称'),
|
|
10
8
|
guild_id: z.string().describe('频道 ID'),
|
|
11
9
|
}),
|
|
12
|
-
|
|
10
|
+
adapter: 'qq',
|
|
13
11
|
tags: ['qq'],
|
|
14
12
|
permissions: [platformPermit('manage_channels')],
|
|
15
|
-
async execute({
|
|
16
|
-
const
|
|
17
|
-
const channels = await
|
|
13
|
+
async execute({ guild_id }: { guild_id: string }, context) {
|
|
14
|
+
const client = context.$client;
|
|
15
|
+
const channels = await client.getChannels(guild_id);
|
|
18
16
|
return { channels, count: channels.length };
|
|
19
17
|
},
|
|
20
18
|
});
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { getQqAgentDeps } from '../../src/qq-agent-deps.js';
|
|
4
3
|
|
|
5
|
-
export default defineAgentTool<
|
|
4
|
+
export default defineAgentTool<Record<string, never>>({
|
|
6
5
|
description: '获取 QQ 频道列表',
|
|
7
|
-
inputSchema: z.object({
|
|
8
|
-
|
|
9
|
-
}),
|
|
10
|
-
platforms: ['qq'],
|
|
6
|
+
inputSchema: z.object({}),
|
|
7
|
+
adapter: 'qq',
|
|
11
8
|
tags: ['qq'],
|
|
12
|
-
async execute(
|
|
13
|
-
const
|
|
14
|
-
const guilds = await
|
|
9
|
+
async execute(_input, context) {
|
|
10
|
+
const client = context.$client;
|
|
11
|
+
const guilds = await client.getGuilds();
|
|
15
12
|
return { guilds, count: guilds.length };
|
|
16
13
|
},
|
|
17
14
|
});
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { platformPermit } from '../../src/platform-permit.js';
|
|
4
|
-
import { getQqAgentDeps } from '../../src/qq-agent-deps.js';
|
|
5
4
|
|
|
6
|
-
export default defineAgentTool<{
|
|
5
|
+
export default defineAgentTool<{ guild_id: string }>({
|
|
7
6
|
description: '获取 QQ 频道角色列表',
|
|
8
7
|
inputSchema: z.object({
|
|
9
|
-
endpoint_id: z.string().describe('Endpoint 名称'),
|
|
10
8
|
guild_id: z.string().describe('频道 ID'),
|
|
11
9
|
}),
|
|
12
|
-
|
|
10
|
+
adapter: 'qq',
|
|
13
11
|
tags: ['qq'],
|
|
14
12
|
permissions: [platformPermit('manage_roles')],
|
|
15
|
-
async execute({
|
|
16
|
-
const
|
|
17
|
-
const roles = await
|
|
13
|
+
async execute({ guild_id }: { guild_id: string }, context) {
|
|
14
|
+
const client = context.$client;
|
|
15
|
+
const roles = await client.getGuildRoles(guild_id);
|
|
18
16
|
return { roles, count: roles.length };
|
|
19
17
|
},
|
|
20
18
|
});
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { platformPermit } from '../../src/platform-permit.js';
|
|
4
|
-
import { getQqAgentDeps } from '../../src/qq-agent-deps.js';
|
|
5
4
|
|
|
6
|
-
export default defineAgentTool<{
|
|
5
|
+
export default defineAgentTool<{ guild_id: string; user_id: string }>({
|
|
7
6
|
description: '获取 QQ 频道中指定成员的详细信息',
|
|
8
7
|
inputSchema: z.object({
|
|
9
|
-
endpoint_id: z.string().describe('Endpoint 名称'),
|
|
10
8
|
guild_id: z.string().describe('频道 ID'),
|
|
11
9
|
user_id: z.string().describe('用户 ID'),
|
|
12
10
|
}),
|
|
13
|
-
|
|
11
|
+
adapter: 'qq',
|
|
14
12
|
tags: ['qq'],
|
|
15
13
|
permissions: [platformPermit('guild_admin')],
|
|
16
|
-
async execute({
|
|
17
|
-
const
|
|
18
|
-
return
|
|
14
|
+
async execute({ guild_id, user_id }: { guild_id: string; user_id: string }, context) {
|
|
15
|
+
const client = context.$client;
|
|
16
|
+
return client.getGuildMember(guild_id, user_id);
|
|
19
17
|
},
|
|
20
18
|
});
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { platformPermit } from '../../src/platform-permit.js';
|
|
4
|
-
import { getQqAgentDeps } from '../../src/qq-agent-deps.js';
|
|
5
4
|
|
|
6
|
-
export default defineAgentTool<{
|
|
5
|
+
export default defineAgentTool<{ guild_id: string; channel_id: string; user_id: string; role_id: string }>({
|
|
7
6
|
description: '移除成员的 QQ 频道角色',
|
|
8
7
|
inputSchema: z.object({
|
|
9
|
-
endpoint_id: z.string().describe('Endpoint 名称'),
|
|
10
8
|
guild_id: z.string().describe('频道 ID'),
|
|
11
9
|
channel_id: z.string().describe('子频道 ID'),
|
|
12
10
|
user_id: z.string().describe('用户 ID'),
|
|
13
11
|
role_id: z.string().describe('角色 ID'),
|
|
14
12
|
}),
|
|
15
|
-
|
|
13
|
+
adapter: 'qq',
|
|
16
14
|
tags: ['qq'],
|
|
17
15
|
permissions: [platformPermit('manage_roles')],
|
|
18
|
-
async execute({
|
|
19
|
-
const
|
|
20
|
-
const success = await
|
|
16
|
+
async execute({ guild_id, channel_id, user_id, role_id }: { guild_id: string; channel_id: string; user_id: string; role_id: string }, context) {
|
|
17
|
+
const client = context.$client;
|
|
18
|
+
const success = await client.removeMemberRole(guild_id, channel_id, user_id, role_id);
|
|
21
19
|
return { success, message: success ? '已移除成员的角色' : '操作失败' };
|
|
22
20
|
},
|
|
23
21
|
});
|
package/lib/client.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { QqInboundMessage } from './protocol.js';
|
|
2
|
+
import type { QqBotTransport } from './ws.js';
|
|
3
|
+
export type QqClientEventMap = Record<string, QqInboundMessage | unknown>;
|
|
4
|
+
declare module '@zhin.js/feature-kit' {
|
|
5
|
+
interface AdapterClientRegistry {
|
|
6
|
+
readonly qq: {
|
|
7
|
+
readonly client: QqBotTransport;
|
|
8
|
+
readonly events: QqClientEventMap;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare const qqClient: import("@zhin.js/adapter").EndpointClientToken<QqBotTransport, QqClientEventMap>;
|
package/lib/client.js
ADDED
package/lib/endpoint.d.ts
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
|
+
import { Endpoint } from 'zhin.js/adapter';
|
|
1
2
|
/**
|
|
2
3
|
* QQ endpoints — lifecycle, outbound, admit, agent tool surface.
|
|
3
4
|
*/
|
|
4
|
-
import { type EndpointControl, type
|
|
5
|
-
import type { MessageGateway, SideEventGateway } from '@zhin.js/core/runtime';
|
|
5
|
+
import { type EndpointControl, type EndpointManagement, type EndpointSendRequest } from 'zhin.js/adapter';
|
|
6
6
|
import type { HttpHost } from '@zhin.js/host-http';
|
|
7
7
|
import type { CapabilityId } from 'zhin.js';
|
|
8
8
|
import { type QqInboundMessage, type ResolvedQqHttpConfig, type ResolvedQqWebsocketConfig } from './protocol.js';
|
|
9
|
-
import { type CreateQqHttpBot } from './webhook.js';
|
|
10
|
-
import { type CreateQqBot } from './ws.js';
|
|
9
|
+
import { type CreateQqHttpBot, type QqHttpBotTransport } from './webhook.js';
|
|
10
|
+
import { type CreateQqBot, type QqBotTransport } from './ws.js';
|
|
11
11
|
export type { CreateQqBot, QqBotTransport } from './ws.js';
|
|
12
12
|
export type { CreateQqHttpBot, QqHttpBotTransport } from './webhook.js';
|
|
13
13
|
export interface QqEndpointOptions {
|
|
14
14
|
readonly id: CapabilityId;
|
|
15
|
-
readonly gateway: MessageGateway;
|
|
16
|
-
readonly sideEvents?: SideEventGateway;
|
|
17
15
|
readonly config: ResolvedQqWebsocketConfig;
|
|
18
16
|
readonly createBot?: CreateQqBot;
|
|
19
17
|
}
|
|
20
|
-
export declare class QqWebsocketEndpoint
|
|
18
|
+
export declare class QqWebsocketEndpoint extends Endpoint<QqBotTransport> {
|
|
21
19
|
#private;
|
|
22
20
|
readonly management: EndpointManagement;
|
|
23
21
|
readonly control: EndpointControl;
|
|
24
22
|
constructor(options: QqEndpointOptions);
|
|
23
|
+
get client(): QqBotTransport;
|
|
25
24
|
/** Live endpoint 名(Console/AdapterIndex 展示用,如 bot appid 别名)。 */
|
|
26
25
|
get name(): string;
|
|
27
26
|
start(): Promise<void>;
|
|
@@ -32,29 +31,20 @@ export declare class QqWebsocketEndpoint implements EndpointInstance {
|
|
|
32
31
|
recallMessage(messageId: string): Promise<void>;
|
|
33
32
|
/** Test / internal: admit a message when open. */
|
|
34
33
|
admit(msg: QqInboundMessage): void;
|
|
35
|
-
getGuilds(): Promise<unknown[]>;
|
|
36
|
-
getChannels(guildId: string): Promise<unknown[]>;
|
|
37
|
-
getChannelInfo(channelId: string): Promise<unknown>;
|
|
38
|
-
getGuildMember(guildId: string, userId: string): Promise<unknown>;
|
|
39
|
-
getGuildRoles(guildId: string): Promise<unknown[]>;
|
|
40
|
-
createGuildRole(guildId: string, name: string, color?: number): Promise<unknown>;
|
|
41
|
-
addMemberRole(guildId: string, channelId: string, userId: string, roleId: string): Promise<boolean>;
|
|
42
|
-
removeMemberRole(guildId: string, channelId: string, userId: string, roleId: string): Promise<boolean>;
|
|
43
34
|
}
|
|
44
35
|
export interface QqHttpEndpointOptions {
|
|
45
36
|
readonly id: CapabilityId;
|
|
46
|
-
readonly gateway: MessageGateway;
|
|
47
|
-
readonly sideEvents?: SideEventGateway;
|
|
48
37
|
readonly http: HttpHost;
|
|
49
38
|
readonly config: ResolvedQqHttpConfig;
|
|
50
39
|
readonly createBot?: CreateQqHttpBot;
|
|
51
40
|
}
|
|
52
41
|
/** Webhook / middleware inbound via httpHostToken POST (qq-official-bot Middleware receiver). */
|
|
53
|
-
export declare class QqHttpEndpoint
|
|
42
|
+
export declare class QqHttpEndpoint extends Endpoint<QqHttpBotTransport> {
|
|
54
43
|
#private;
|
|
55
44
|
readonly management: EndpointManagement;
|
|
56
45
|
readonly control: EndpointControl;
|
|
57
46
|
constructor(options: QqHttpEndpointOptions);
|
|
47
|
+
get client(): QqHttpBotTransport;
|
|
58
48
|
/** Live endpoint 名(Console/AdapterIndex 展示用)。 */
|
|
59
49
|
get name(): string;
|
|
60
50
|
start(): Promise<void>;
|
|
@@ -64,12 +54,4 @@ export declare class QqHttpEndpoint implements EndpointInstance {
|
|
|
64
54
|
send({ conversation, payload }: EndpointSendRequest): Promise<string>;
|
|
65
55
|
recallMessage(messageId: string): Promise<void>;
|
|
66
56
|
admit(msg: QqInboundMessage): void;
|
|
67
|
-
getGuilds(): Promise<unknown[]>;
|
|
68
|
-
getChannels(guildId: string): Promise<unknown[]>;
|
|
69
|
-
getChannelInfo(channelId: string): Promise<unknown>;
|
|
70
|
-
getGuildMember(guildId: string, userId: string): Promise<unknown>;
|
|
71
|
-
getGuildRoles(guildId: string): Promise<unknown[]>;
|
|
72
|
-
createGuildRole(guildId: string, name: string, color?: number): Promise<unknown>;
|
|
73
|
-
addMemberRole(guildId: string, channelId: string, userId: string, roleId: string): Promise<boolean>;
|
|
74
|
-
removeMemberRole(guildId: string, channelId: string, userId: string, roleId: string): Promise<boolean>;
|
|
75
57
|
}
|