@zhin.js/adapter-icqq 8.0.3 → 8.0.5

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/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 name?: string;
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 name?: string;
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 name: string;
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 name = pickCredential(config.name, entry?.name, process.env.ICQQ_ACCOUNT);
338
- if (!/^\d+$/.test(name)) {
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 name (QQ uin) via plugins.<key>.name or ICQQ_ACCOUNT',
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
- name,
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(endpointId: string, input: {
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: endpointId, adapter: endpointId.split('\0')[0] ?? endpointId };
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