@zhin.js/adapter-icqq 1.1.26 → 1.1.27
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 +147 -0
- package/LICENSE +21 -0
- package/PERMITS.md +5 -1
- package/README.md +6 -2
- package/adapters/icqq/index.js +4 -0
- package/adapters/icqq/index.ts +4 -0
- package/agents/icqq/conversation.js +3 -2
- package/agents/icqq/conversation.ts +3 -2
- package/agents/icqq/skills/icqq-conversation/tools/conversation_info/index.js +2 -2
- package/agents/icqq/skills/icqq-conversation/tools/conversation_info/index.ts +2 -2
- package/agents/icqq/skills/icqq-directory/tools/friend_list/index.js +1 -1
- package/agents/icqq/skills/icqq-directory/tools/friend_list/index.ts +1 -1
- package/agents/icqq/skills/icqq-directory/tools/group_list/index.js +1 -1
- package/agents/icqq/skills/icqq-directory/tools/group_list/index.ts +1 -1
- package/agents/icqq/skills/icqq-group-admin/tools/announce/index.js +6 -5
- package/agents/icqq/skills/icqq-group-admin/tools/announce/index.ts +7 -6
- package/agents/icqq/skills/icqq-group-admin/tools/essence/index.js +7 -3
- package/agents/icqq/skills/icqq-group-admin/tools/essence/index.ts +7 -3
- package/agents/icqq/skills/icqq-group-admin/tools/group_invite/index.js +4 -3
- package/agents/icqq/skills/icqq-group-admin/tools/group_invite/index.ts +5 -4
- package/agents/icqq/skills/icqq-group-admin/tools/group_kick/index.js +6 -5
- package/agents/icqq/skills/icqq-group-admin/tools/group_kick/index.ts +7 -6
- package/agents/icqq/skills/icqq-group-admin/tools/group_leave/index.js +1 -1
- package/agents/icqq/skills/icqq-group-admin/tools/group_leave/index.ts +1 -1
- package/agents/icqq/skills/icqq-group-admin/tools/recall_member_message/index.js +1 -2
- package/agents/icqq/skills/icqq-group-admin/tools/recall_member_message/index.ts +1 -2
- package/agents/icqq/skills/icqq-group-admin/tools/set_anonymous/index.js +5 -4
- package/agents/icqq/skills/icqq-group-admin/tools/set_anonymous/index.ts +6 -5
- package/agents/icqq/skills/icqq-group-admin/tools/set_group_admin/index.js +6 -6
- package/agents/icqq/skills/icqq-group-admin/tools/set_group_admin/index.ts +7 -7
- package/agents/icqq/skills/icqq-group-admin/tools/set_mute/index.js +5 -3
- package/agents/icqq/skills/icqq-group-admin/tools/set_mute/index.ts +6 -4
- package/agents/icqq/skills/icqq-group-admin/tools/set_title/index.js +5 -3
- package/agents/icqq/skills/icqq-group-admin/tools/set_title/index.ts +6 -4
- package/agents/icqq/skills/icqq-group-directory/tools/group_member_info/index.js +5 -4
- package/agents/icqq/skills/icqq-group-directory/tools/group_member_info/index.ts +5 -5
- package/agents/icqq/skills/icqq-group-interaction/tools/group_sign/index.js +5 -5
- package/agents/icqq/skills/icqq-group-interaction/tools/group_sign/index.ts +6 -6
- package/agents/icqq/skills/icqq-group-interaction/tools/poke/index.js +4 -4
- package/agents/icqq/skills/icqq-group-interaction/tools/poke/index.ts +5 -5
- package/agents/icqq/skills/icqq-group-state/SKILL.md +1 -1
- package/agents/icqq/skills/icqq-group-state/tools/group_files/index.js +6 -7
- package/agents/icqq/skills/icqq-group-state/tools/group_files/index.ts +7 -8
- package/agents/icqq/skills/icqq-group-state/tools/list_muted/index.js +5 -6
- package/agents/icqq/skills/icqq-group-state/tools/list_muted/index.ts +6 -7
- package/commands/icqq/login/definition.js +19 -16
- package/commands/icqq/login/definition.ts +18 -18
- package/lib/endpoint.js +3 -2
- package/lib/group-scene.d.ts +3 -0
- package/lib/group-scene.js +11 -0
- package/lib/protocol.d.ts +3 -1
- package/package.json +29 -28
- package/plugin.js +0 -5
- package/schema.json +0 -55
- package/src/endpoint.ts +3 -2
- package/src/group-scene.ts +12 -0
- package/src/protocol.ts +3 -2
package/lib/endpoint.js
CHANGED
|
@@ -16,7 +16,7 @@ import { formatInboundContent, formatOutboundMessageParts, normalizeIcqqImageMed
|
|
|
16
16
|
import { ManagedIcqqClient } from './managed-client.js';
|
|
17
17
|
import { createIcqqActionPorts } from './group-actions.js';
|
|
18
18
|
import { inspectGroupMember, moderateGroupMember } from './group-moderation.js';
|
|
19
|
-
import { inspectGroupMemberProfile, inspectGroupScene } from './group-scene.js';
|
|
19
|
+
import { inspectGroupMemberProfile, inspectGroupScene, inspectSelfStanding } from './group-scene.js';
|
|
20
20
|
import { createIcqqSelfProfile } from './self-profile.js';
|
|
21
21
|
const BOUND_EVENTS = [
|
|
22
22
|
'message.private',
|
|
@@ -69,6 +69,7 @@ export class IcqqEndpoint extends ManagedIcqqClient {
|
|
|
69
69
|
inspectGroupMember: request => inspectGroupMember(this, request),
|
|
70
70
|
inspectGroupScene: request => inspectGroupScene(this, request),
|
|
71
71
|
inspectGroupMemberProfile: request => inspectGroupMemberProfile(this, request),
|
|
72
|
+
inspectSelfStanding: request => inspectSelfStanding(this, request),
|
|
72
73
|
moderateGroupMember: request => moderateGroupMember({ client: this, isActive: () => this.#open && !this.#retiring && !this.#stopped }, request),
|
|
73
74
|
listFriends: async (request = {}) => createEndpointOperation(request).run(() => Array.from(this.fl.values()).map((f) => ({
|
|
74
75
|
user_id: f.user_id,
|
|
@@ -977,7 +978,7 @@ export class IcqqEndpoint extends ManagedIcqqClient {
|
|
|
977
978
|
sender: {
|
|
978
979
|
id: normalized.userId,
|
|
979
980
|
name: normalized.nickname || undefined,
|
|
980
|
-
...(normalized.senderRole ? {
|
|
981
|
+
...(normalized.senderRole ? { platform: { standing: normalized.senderRole } } : {}),
|
|
981
982
|
},
|
|
982
983
|
channelType: normalized.channelType,
|
|
983
984
|
...(quoteId ? { replyTo: { id: quoteId } } : {}),
|
package/lib/group-scene.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Client } from '@icqqjs/icqq';
|
|
2
|
+
import { type PlatformStanding, type SelfStandingRequest } from '@zhin.js/im-contract';
|
|
2
3
|
import { type EndpointGroupInspectionRequest, type EndpointMemberInspectionRequest, type GroupMemberProfile, type GroupSceneFacts } from 'zhin.js/adapter';
|
|
3
4
|
/** Listing a very large roster only to find admins is not worth the packet; adminIds stay unknown. */
|
|
4
5
|
export declare const ADMIN_SCAN_MAX_MEMBERS = 1000;
|
|
@@ -9,3 +10,5 @@ export declare const ADMIN_SCAN_MAX_MEMBERS = 1000;
|
|
|
9
10
|
export declare function inspectGroupScene(client: Client, { groupId, signal }: EndpointGroupInspectionRequest): Promise<GroupSceneFacts>;
|
|
10
11
|
/** ADR 0041 member facts from one uncached lookup (same rationale as the agent `freshMember` helper). */
|
|
11
12
|
export declare function inspectGroupMemberProfile(client: Client, { groupId, userId, signal }: EndpointMemberInspectionRequest): Promise<GroupMemberProfile>;
|
|
13
|
+
/** ADR 0056 §1: the Bot's own standing in a group (`scene.selfStanding`); undefined outside groups. */
|
|
14
|
+
export declare function inspectSelfStanding(client: Client, { conversation, signal }: SelfStandingRequest): Promise<PlatformStanding | undefined>;
|
package/lib/group-scene.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { standingFromMemberRole } from '@zhin.js/im-contract';
|
|
1
2
|
import { createEndpointOperation } from 'zhin.js/adapter';
|
|
2
3
|
/** Listing a very large roster only to find admins is not worth the packet; adminIds stay unknown. */
|
|
3
4
|
export const ADMIN_SCAN_MAX_MEMBERS = 1000;
|
|
@@ -70,3 +71,13 @@ export async function inspectGroupMemberProfile(client, { groupId, userId, signa
|
|
|
70
71
|
? { mutedUntil: shutupSeconds * 1000 > Date.now() ? shutupSeconds * 1000 : 0 } : {}),
|
|
71
72
|
};
|
|
72
73
|
}
|
|
74
|
+
/** ADR 0056 §1: the Bot's own standing in a group (`scene.selfStanding`); undefined outside groups. */
|
|
75
|
+
export async function inspectSelfStanding(client, { conversation, signal }) {
|
|
76
|
+
if (conversation.kind !== 'group')
|
|
77
|
+
return undefined;
|
|
78
|
+
const self = client.uin;
|
|
79
|
+
if (!self)
|
|
80
|
+
return undefined;
|
|
81
|
+
const profile = await inspectGroupMemberProfile(client, { groupId: conversation.id, userId: String(self), signal });
|
|
82
|
+
return standingFromMemberRole(profile.platformRole);
|
|
83
|
+
}
|
package/lib/protocol.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EndpointProfileConfiguration } from 'zhin.js/adapter';
|
|
2
2
|
import type { Sendable } from '@icqqjs/icqq';
|
|
3
|
-
import { type ConversationRef } from '@zhin.js/im-contract';
|
|
3
|
+
import { type ConversationRef, type PlatformStanding } from '@zhin.js/im-contract';
|
|
4
4
|
import { type AdapterNotifyTarget, type ResolvedAdapterNotifyTarget } from 'zhin.js/adapter';
|
|
5
5
|
import type { MessageSegment, SendContent } from "zhin.js";
|
|
6
6
|
export type ActionResult = {
|
|
@@ -217,9 +217,11 @@ export interface IcqqInboundMessage {
|
|
|
217
217
|
* 与 content(CQ 原文纯文本视图)同源,随 gateway.receive 上送。
|
|
218
218
|
*/
|
|
219
219
|
readonly segments?: readonly MessageSegment[];
|
|
220
|
+
/** `platform`: ADR 0056 §1 normalized standing (group messages only). */
|
|
220
221
|
readonly sender: {
|
|
221
222
|
readonly id: string;
|
|
222
223
|
readonly name?: string;
|
|
224
|
+
readonly platform?: PlatformStanding;
|
|
223
225
|
};
|
|
224
226
|
readonly channelType: 'private' | 'group' | 'channel';
|
|
225
227
|
readonly metadata?: Record<string, unknown>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-icqq",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.27",
|
|
4
4
|
"description": "Zhin.js ICQQ adapter — direct connection to @icqqjs/icqq",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -33,28 +33,28 @@
|
|
|
33
33
|
"directory": "plugins/adapters/icqq"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"
|
|
37
|
-
"@zhin.js/adapter": "1.1.
|
|
38
|
-
"@zhin.js/
|
|
39
|
-
"@zhin.js/
|
|
40
|
-
"@zhin.js/
|
|
41
|
-
"@zhin.js/
|
|
42
|
-
"@zhin.js/
|
|
43
|
-
"@zhin.js/
|
|
44
|
-
"@zhin.js/
|
|
45
|
-
"@zhin.js/
|
|
46
|
-
"@zhin.js/
|
|
47
|
-
"@zhin.js/
|
|
36
|
+
"zod": "^4.6.7",
|
|
37
|
+
"@zhin.js/adapter": "1.1.33",
|
|
38
|
+
"@zhin.js/adapter-onebot-events": "0.0.6",
|
|
39
|
+
"@zhin.js/agent-feature": "1.1.17",
|
|
40
|
+
"@zhin.js/console-contract": "1.1.6",
|
|
41
|
+
"@zhin.js/core": "1.2.0",
|
|
42
|
+
"@zhin.js/feature-kit": "1.1.16",
|
|
43
|
+
"@zhin.js/im-contract": "1.1.14",
|
|
44
|
+
"@zhin.js/logger": "1.1.3",
|
|
45
|
+
"@zhin.js/page": "1.1.18",
|
|
46
|
+
"@zhin.js/permission": "1.2.0",
|
|
47
|
+
"@zhin.js/skill": "1.1.17",
|
|
48
|
+
"@zhin.js/tool": "1.1.19"
|
|
48
49
|
},
|
|
49
50
|
"peerDependencies": {
|
|
50
51
|
"@icqqjs/icqq": "^1.12.2",
|
|
51
|
-
"
|
|
52
|
-
"@zhin.js/
|
|
53
|
-
"@zhin.js/
|
|
54
|
-
"@zhin.js/
|
|
55
|
-
"@zhin.js/
|
|
56
|
-
"
|
|
57
|
-
"zhin.js": "^1.1.25"
|
|
52
|
+
"@zhin.js/adapter": "^1.1.33",
|
|
53
|
+
"@zhin.js/agent": "^1.2.0",
|
|
54
|
+
"@zhin.js/command": "^1.2.0",
|
|
55
|
+
"@zhin.js/core": "^1.2.0",
|
|
56
|
+
"@zhin.js/prompt-section": "^1.1.16",
|
|
57
|
+
"zhin.js": "^1.1.26"
|
|
58
58
|
},
|
|
59
59
|
"peerDependenciesMeta": {
|
|
60
60
|
"@icqqjs/icqq": {
|
|
@@ -71,9 +71,6 @@
|
|
|
71
71
|
},
|
|
72
72
|
"zhin.js": {
|
|
73
73
|
"optional": true
|
|
74
|
-
},
|
|
75
|
-
"zod": {
|
|
76
|
-
"optional": true
|
|
77
74
|
}
|
|
78
75
|
},
|
|
79
76
|
"devDependencies": {
|
|
@@ -81,10 +78,9 @@
|
|
|
81
78
|
"@types/node": "^26.1.2",
|
|
82
79
|
"typescript": "^6.0.3",
|
|
83
80
|
"vitest": "^4.1.10",
|
|
84
|
-
"
|
|
85
|
-
"@zhin.js/
|
|
86
|
-
"
|
|
87
|
-
"zhin.js": "1.1.25"
|
|
81
|
+
"@zhin.js/agent": "1.2.0",
|
|
82
|
+
"@zhin.js/prompt-section": "1.1.16",
|
|
83
|
+
"zhin.js": "1.1.26"
|
|
88
84
|
},
|
|
89
85
|
"files": [
|
|
90
86
|
"adapters",
|
|
@@ -137,6 +133,11 @@
|
|
|
137
133
|
{
|
|
138
134
|
"package": "@zhin.js/page",
|
|
139
135
|
"api": "^1.0.0"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"package": "@zhin.js/prompt-section",
|
|
139
|
+
"api": "^1.0.0",
|
|
140
|
+
"optional": true
|
|
140
141
|
}
|
|
141
142
|
],
|
|
142
143
|
"plugins": []
|
|
@@ -144,7 +145,7 @@
|
|
|
144
145
|
"scripts": {
|
|
145
146
|
"build": "tsc",
|
|
146
147
|
"clean": "rimraf lib",
|
|
147
|
-
"test": "pnpm run test:types &&
|
|
148
|
+
"test": "pnpm run test:types && vitest run --root ../../.. plugins/adapters/icqq/tests",
|
|
148
149
|
"test:types": "tsc -p tsconfig.type-tests.json"
|
|
149
150
|
}
|
|
150
151
|
}
|
package/plugin.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
2
|
import { definePlugin } from 'zhin.js';
|
|
3
|
-
import { permissionHostToken, createSceneRolePlatformChecker } from '@zhin.js/permission';
|
|
4
3
|
import { registerSensitiveExecCommand } from '@zhin.js/agent';
|
|
5
4
|
import { createIcqqConsoleRpc } from "./lib/console.js";
|
|
6
5
|
import { icqqSensitiveExecRule } from "./lib/sensitive-commands.js";
|
|
@@ -11,15 +10,11 @@ export default definePlugin({
|
|
|
11
10
|
displayName: 'ICQQ Adapter',
|
|
12
11
|
},
|
|
13
12
|
setup(context) {
|
|
14
|
-
const disposePlatform = context.resources.has(permissionHostToken)
|
|
15
|
-
? context.resources.use(permissionHostToken).registerPlatform('icqq', createSceneRolePlatformChecker())
|
|
16
|
-
: undefined;
|
|
17
13
|
const disposeExecRule = registerSensitiveExecCommand(icqqSensitiveExecRule);
|
|
18
14
|
return {
|
|
19
15
|
consoleRpc: createIcqqConsoleRpc(() => context.config.get()),
|
|
20
16
|
dispose: () => {
|
|
21
17
|
disposeExecRule();
|
|
22
|
-
disposePlatform?.();
|
|
23
18
|
},
|
|
24
19
|
};
|
|
25
20
|
},
|
package/schema.json
CHANGED
|
@@ -3,33 +3,6 @@
|
|
|
3
3
|
"type": "object",
|
|
4
4
|
"additionalProperties": false,
|
|
5
5
|
"properties": {
|
|
6
|
-
"master": {
|
|
7
|
-
"type": [
|
|
8
|
-
"string",
|
|
9
|
-
"number"
|
|
10
|
-
],
|
|
11
|
-
"description": "框架 master QQ uin(/approve、AI/工具权限);endpoints[i].master 可逐项覆盖",
|
|
12
|
-
"x-i18n": {
|
|
13
|
-
"en": {
|
|
14
|
-
"description": "Framework master QQ uin list for approval and AI/tool permissions. endpoints[i].master can override this value."
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"trusted": {
|
|
19
|
-
"type": "array",
|
|
20
|
-
"items": {
|
|
21
|
-
"type": [
|
|
22
|
-
"string",
|
|
23
|
-
"number"
|
|
24
|
-
]
|
|
25
|
-
},
|
|
26
|
-
"description": "框架 trusted QQ uin 列表(弱于 master)",
|
|
27
|
-
"x-i18n": {
|
|
28
|
-
"en": {
|
|
29
|
-
"description": "Framework trusted QQ uin list, below master authority."
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
6
|
"password": {
|
|
34
7
|
"type": "string",
|
|
35
8
|
"description": "QQ 密码(可选,不填则扫码登录)",
|
|
@@ -181,33 +154,6 @@
|
|
|
181
154
|
"pattern": "^[0-9]+$",
|
|
182
155
|
"description": "QQ uin"
|
|
183
156
|
},
|
|
184
|
-
"master": {
|
|
185
|
-
"type": [
|
|
186
|
-
"string",
|
|
187
|
-
"number"
|
|
188
|
-
],
|
|
189
|
-
"description": "本 endpoint 的 master QQ uin;覆盖顶层 master",
|
|
190
|
-
"x-i18n": {
|
|
191
|
-
"en": {
|
|
192
|
-
"description": "Master QQ uin list for this endpoint, overriding the top-level master list."
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
"trusted": {
|
|
197
|
-
"type": "array",
|
|
198
|
-
"items": {
|
|
199
|
-
"type": [
|
|
200
|
-
"string",
|
|
201
|
-
"number"
|
|
202
|
-
]
|
|
203
|
-
},
|
|
204
|
-
"description": "本 endpoint 的 trusted 列表",
|
|
205
|
-
"x-i18n": {
|
|
206
|
-
"en": {
|
|
207
|
-
"description": "Trusted users for this endpoint."
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
157
|
"password": {
|
|
212
158
|
"type": "string",
|
|
213
159
|
"description": "本 endpoint 的 QQ 密码",
|
|
@@ -586,7 +532,6 @@
|
|
|
586
532
|
}
|
|
587
533
|
},
|
|
588
534
|
"required": [
|
|
589
|
-
"master",
|
|
590
535
|
"endpoints"
|
|
591
536
|
],
|
|
592
537
|
"$defs": {
|
package/src/endpoint.ts
CHANGED
|
@@ -80,7 +80,7 @@ import type { SystemMessage as IcqqSystemMessage } from './types.js';
|
|
|
80
80
|
import { ManagedIcqqClient, type IcqqBackgroundOperation } from './managed-client.js';
|
|
81
81
|
import { createIcqqActionPorts } from './group-actions.js';
|
|
82
82
|
import { inspectGroupMember, moderateGroupMember } from './group-moderation.js';
|
|
83
|
-
import { inspectGroupMemberProfile, inspectGroupScene } from './group-scene.js';
|
|
83
|
+
import { inspectGroupMemberProfile, inspectGroupScene, inspectSelfStanding } from './group-scene.js';
|
|
84
84
|
import { createIcqqSelfProfile } from './self-profile.js';
|
|
85
85
|
|
|
86
86
|
export interface IcqqEndpointOptions {
|
|
@@ -147,6 +147,7 @@ export class IcqqEndpoint extends ManagedIcqqClient implements Endpoint {
|
|
|
147
147
|
inspectGroupMember: request => inspectGroupMember(this, request),
|
|
148
148
|
inspectGroupScene: request => inspectGroupScene(this, request),
|
|
149
149
|
inspectGroupMemberProfile: request => inspectGroupMemberProfile(this, request),
|
|
150
|
+
inspectSelfStanding: request => inspectSelfStanding(this, request),
|
|
150
151
|
moderateGroupMember: request => moderateGroupMember({ client: this, isActive: () => this.#open && !this.#retiring && !this.#stopped }, request),
|
|
151
152
|
listFriends: async (request: EndpointManagementRequest = {}) =>
|
|
152
153
|
createEndpointOperation(request).run(() => Array.from(this.fl.values()).map((f) => ({
|
|
@@ -1054,7 +1055,7 @@ export class IcqqEndpoint extends ManagedIcqqClient implements Endpoint {
|
|
|
1054
1055
|
sender: {
|
|
1055
1056
|
id: normalized.userId,
|
|
1056
1057
|
name: normalized.nickname || undefined,
|
|
1057
|
-
...(normalized.senderRole ? {
|
|
1058
|
+
...(normalized.senderRole ? { platform: { standing: normalized.senderRole } } : {}),
|
|
1058
1059
|
},
|
|
1059
1060
|
channelType: normalized.channelType,
|
|
1060
1061
|
...(quoteId ? { replyTo: { id: quoteId } } : {}),
|
package/src/group-scene.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Client } from '@icqqjs/icqq';
|
|
2
|
+
import { standingFromMemberRole, type PlatformStanding, type SelfStandingRequest } from '@zhin.js/im-contract';
|
|
2
3
|
import { createEndpointOperation, type EndpointGroupInspectionRequest, type EndpointMemberInspectionRequest, type GroupMemberProfile, type GroupSceneFacts } from 'zhin.js/adapter';
|
|
3
4
|
|
|
4
5
|
/** Listing a very large roster only to find admins is not worth the packet; adminIds stay unknown. */
|
|
@@ -74,3 +75,14 @@ export async function inspectGroupMemberProfile(
|
|
|
74
75
|
? { mutedUntil: shutupSeconds * 1000 > Date.now() ? shutupSeconds * 1000 : 0 } : {}),
|
|
75
76
|
};
|
|
76
77
|
}
|
|
78
|
+
|
|
79
|
+
/** ADR 0056 §1: the Bot's own standing in a group (`scene.selfStanding`); undefined outside groups. */
|
|
80
|
+
export async function inspectSelfStanding(
|
|
81
|
+
client: Client, { conversation, signal }: SelfStandingRequest,
|
|
82
|
+
): Promise<PlatformStanding | undefined> {
|
|
83
|
+
if (conversation.kind !== 'group') return undefined;
|
|
84
|
+
const self = client.uin;
|
|
85
|
+
if (!self) return undefined;
|
|
86
|
+
const profile = await inspectGroupMemberProfile(client, { groupId: conversation.id, userId: String(self), signal });
|
|
87
|
+
return standingFromMemberRole(profile.platformRole);
|
|
88
|
+
}
|
package/src/protocol.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EndpointProfileConfiguration } from 'zhin.js/adapter';
|
|
2
2
|
import type { MessageElem, Sendable, ShareElem } from '@icqqjs/icqq';
|
|
3
|
-
import { isMediaRef, type ConversationRef } from '@zhin.js/im-contract';
|
|
3
|
+
import { isMediaRef, type ConversationRef, type PlatformStanding } from '@zhin.js/im-contract';
|
|
4
4
|
import { resolveAdapterNotifyTarget, type AdapterNotifyTarget, type ResolvedAdapterNotifyTarget } from 'zhin.js/adapter';
|
|
5
5
|
import type { MessageSegment, SendContent } from "zhin.js";
|
|
6
6
|
import { resolveIcqqMediaFile } from "./cq-message.js";
|
|
@@ -289,7 +289,8 @@ export interface IcqqInboundMessage {
|
|
|
289
289
|
* 与 content(CQ 原文纯文本视图)同源,随 gateway.receive 上送。
|
|
290
290
|
*/
|
|
291
291
|
readonly segments?: readonly MessageSegment[];
|
|
292
|
-
|
|
292
|
+
/** `platform`: ADR 0056 §1 normalized standing (group messages only). */
|
|
293
|
+
readonly sender: { readonly id: string; readonly name?: string; readonly platform?: PlatformStanding };
|
|
293
294
|
readonly channelType: 'private' | 'group' | 'channel';
|
|
294
295
|
readonly metadata?: Record<string, unknown>;
|
|
295
296
|
readonly replyTo?: { readonly id: string };
|