@zhin.js/adapter-icqq 8.0.3 → 8.0.6
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 +83 -0
- package/adapters/icqq.js +2 -2
- package/adapters/icqq.ts +2 -2
- package/lib/endpoint.js +51 -79
- package/lib/icqq-agent-deps.d.ts +2 -2
- package/lib/icqq-agent-deps.js +7 -7
- package/lib/icqq-endpoint-commands.js +7 -7
- package/lib/icqq-inbox.d.ts +1 -1
- package/lib/icqq-inbox.js +3 -3
- package/lib/protocol.d.ts +8 -5
- package/lib/protocol.js +6 -6
- package/package.json +14 -14
- package/schema.json +11 -11
- package/src/endpoint.ts +63 -82
- package/src/icqq-agent-deps.ts +8 -8
- package/src/icqq-endpoint-commands.ts +7 -7
- package/src/icqq-inbox.ts +4 -4
- package/src/protocol.ts +10 -10
- /package/commands/endpoint/add/{[[name]].js → [[id]].js} +0 -0
- /package/commands/endpoint/add/{[[name]].ts → [[id]].ts} +0 -0
- /package/commands/endpoint/remove/{[name].js → [id].js} +0 -0
- /package/commands/endpoint/remove/{[name].ts → [id].ts} +0 -0
package/src/protocol.ts
CHANGED
|
@@ -273,7 +273,7 @@ export const Actions = {
|
|
|
273
273
|
|
|
274
274
|
/** Plugin Runtime owner config (`plugins.<instanceKey>` / schema.json). */
|
|
275
275
|
export interface IcqqAdapterConfig {
|
|
276
|
-
readonly
|
|
276
|
+
readonly id?: string;
|
|
277
277
|
readonly autoReconnect?: boolean;
|
|
278
278
|
readonly outboundMedia?: 'file' | 'base64';
|
|
279
279
|
readonly rpc?: {
|
|
@@ -284,7 +284,7 @@ export interface IcqqAdapterConfig {
|
|
|
284
284
|
/** Transitional: legacy root `endpoints[]` with `context: icqq`. */
|
|
285
285
|
readonly endpoints?: ReadonlyArray<{
|
|
286
286
|
readonly context?: string;
|
|
287
|
-
readonly
|
|
287
|
+
readonly id?: string;
|
|
288
288
|
readonly autoReconnect?: boolean;
|
|
289
289
|
readonly outboundMedia?: 'file' | 'base64';
|
|
290
290
|
readonly rpc?: {
|
|
@@ -297,7 +297,7 @@ export interface IcqqAdapterConfig {
|
|
|
297
297
|
|
|
298
298
|
export interface ResolvedIcqqConfig {
|
|
299
299
|
readonly context: 'icqq';
|
|
300
|
-
readonly
|
|
300
|
+
readonly id: string;
|
|
301
301
|
readonly autoReconnect: boolean;
|
|
302
302
|
readonly outboundMedia?: 'file' | 'base64';
|
|
303
303
|
readonly rpc?: {
|
|
@@ -321,7 +321,7 @@ export interface IcqqInboundMessage {
|
|
|
321
321
|
* 与 content(CQ 原文纯文本视图)同源,随 gateway.receive 上送。
|
|
322
322
|
*/
|
|
323
323
|
readonly segments?: readonly MessageSegment[];
|
|
324
|
-
readonly sender: string;
|
|
324
|
+
readonly sender: { readonly id: string; readonly name?: string };
|
|
325
325
|
readonly channelType: 'private' | 'group' | 'channel';
|
|
326
326
|
readonly metadata?: Record<string, unknown>;
|
|
327
327
|
}
|
|
@@ -334,10 +334,10 @@ export type ParsedIcqqSendTarget =
|
|
|
334
334
|
|
|
335
335
|
export function resolveIcqqConfig(config: IcqqAdapterConfig = {}): ResolvedIcqqConfig {
|
|
336
336
|
const entry = config.endpoints?.find((item) => item.context === 'icqq');
|
|
337
|
-
const
|
|
338
|
-
if (!/^\d+$/.test(
|
|
337
|
+
const id = pickCredential(config.id, entry?.id, process.env.ICQQ_ACCOUNT);
|
|
338
|
+
if (!/^\d+$/.test(id)) {
|
|
339
339
|
throw new TypeError(
|
|
340
|
-
'ICQQ adapter requires numeric
|
|
340
|
+
'ICQQ adapter requires numeric id (QQ uin) via plugins.<key>.id or ICQQ_ACCOUNT',
|
|
341
341
|
);
|
|
342
342
|
}
|
|
343
343
|
const autoReconnect = config.autoReconnect ?? entry?.autoReconnect ?? true;
|
|
@@ -348,7 +348,7 @@ export function resolveIcqqConfig(config: IcqqAdapterConfig = {}): ResolvedIcqqC
|
|
|
348
348
|
: undefined;
|
|
349
349
|
return {
|
|
350
350
|
context: 'icqq',
|
|
351
|
-
|
|
351
|
+
id,
|
|
352
352
|
autoReconnect,
|
|
353
353
|
...(outboundMedia ? { outboundMedia } : {}),
|
|
354
354
|
...(rpc ? { rpc } : {}),
|
|
@@ -359,13 +359,13 @@ export function resolveIcqqConfig(config: IcqqAdapterConfig = {}): ResolvedIcqqC
|
|
|
359
359
|
* 入站归一化 → ConversationRef:群临时会话(temp)映射为群容器内的 private
|
|
360
360
|
* 会话(parent kind 'group');频道消息的所属 guild 进 `parent`(kind 'channel')。
|
|
361
361
|
*/
|
|
362
|
-
export function icqqInboundConversation(
|
|
362
|
+
export function icqqInboundConversation(endpointKey: string, input: {
|
|
363
363
|
readonly channelType: 'private' | 'group' | 'channel';
|
|
364
364
|
readonly channelId: string;
|
|
365
365
|
readonly channelParentGroupId?: string;
|
|
366
366
|
readonly guildId?: string;
|
|
367
367
|
}): ConversationRef {
|
|
368
|
-
const endpoint = { id:
|
|
368
|
+
const endpoint = { id: endpointKey, adapter: endpointKey.split('\0')[0] ?? endpointKey };
|
|
369
369
|
if (input.channelType === 'private' && input.channelParentGroupId) {
|
|
370
370
|
return {
|
|
371
371
|
endpoint,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|