napcon 0.0.9

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.
@@ -0,0 +1,1079 @@
1
+ import { a as ConnectionStreamResult, j as ProtocolEventHandlers, k as ProtocolEvent, on as ProtocolMessageSegment, r as ConnectionEventHandlers, sn as ProtocolMessageSendSegment, t as Connection, x as ProtocolReplyOk } from "../connection-CBr_CAbl.mjs";
2
+
3
+ //#region src/utils/event.d.ts
4
+ type ConnectionOrProtocolEventHandlers = ConnectionEventHandlers & ProtocolEventHandlers & {};
5
+ declare function defineHandler<const K extends keyof ConnectionOrProtocolEventHandlers>(type: K, handler: (...args: ConnectionOrProtocolEventHandlers[K]) => void): (...args: ConnectionOrProtocolEventHandlers[K]) => void;
6
+ declare function matchEvent<const K extends keyof ProtocolEventHandlers>(type: K, handler: (...args: ProtocolEventHandlers[K]) => void): (event: ProtocolEvent, connection: Connection) => void;
7
+ interface EventMatcher<K extends keyof ProtocolEventHandlers> {
8
+ (event: any): event is ProtocolEventHandlers[K];
9
+ }
10
+ declare function createEventMatcher<const K extends keyof ProtocolEventHandlers>(type: K): EventMatcher<K>;
11
+ //#endregion
12
+ //#region src/utils/message.d.ts
13
+ declare function isMessageSegment<const T extends ProtocolMessageSendSegment['type'], R extends Extract<ProtocolMessageSegment, {
14
+ type: T;
15
+ }>>(type: T, value: any): value is R;
16
+ declare function isMessageSegment(type: null, value: any): value is ProtocolMessageSegment;
17
+ declare function createMessageSegment<const T extends ProtocolMessageSendSegment['type'], R extends Extract<ProtocolMessageSendSegment, {
18
+ type: T;
19
+ }>>(type: T, data: R['data']): R;
20
+ declare function findMessageSegment<const T extends ProtocolMessageSendSegment['type'], R extends Extract<ProtocolMessageSendSegment, {
21
+ type: T;
22
+ }>>(type: T, message?: ProtocolMessageSegment[] | string): R | undefined;
23
+ //#endregion
24
+ //#region src/utils/methods.d.ts
25
+ interface ClientMethods {
26
+ send_private_msg: (params: {
27
+ user_id: number | string;
28
+ message: string | ProtocolMessageSendSegment | (string | ProtocolMessageSendSegment)[];
29
+ group_id?: number | string;
30
+ auto_escape?: boolean;
31
+ }) => Promise<ProtocolReplyOk<{
32
+ message_id: number;
33
+ }>>;
34
+ send_group_msg: (params: {
35
+ group_id: number | string;
36
+ message: string | ProtocolMessageSendSegment | (string | ProtocolMessageSendSegment)[];
37
+ auto_escape?: boolean;
38
+ }) => Promise<ProtocolReplyOk<{
39
+ message_id: number;
40
+ }>>;
41
+ send_msg: (params: {
42
+ message_type?: 'private' | 'group';
43
+ user_id?: number | string;
44
+ group_id?: number | string;
45
+ message: string | ProtocolMessageSendSegment | (string | ProtocolMessageSendSegment)[];
46
+ auto_escape?: boolean;
47
+ }) => Promise<ProtocolReplyOk<{
48
+ message_id: number;
49
+ }>>;
50
+ delete_msg: (params: {
51
+ message_id: number;
52
+ }) => Promise<ProtocolReplyOk<void>>;
53
+ get_msg: (params: {
54
+ message_id: number;
55
+ }) => Promise<ProtocolReplyOk<{
56
+ time: number;
57
+ message_type: 'private' | 'group';
58
+ message_id: number;
59
+ real_id: number;
60
+ sender: {
61
+ user_id: number;
62
+ nickname: string;
63
+ card?: string;
64
+ sex?: 'male' | 'female' | 'unknown';
65
+ age?: number;
66
+ };
67
+ message: ProtocolMessageSendSegment[];
68
+ }>>;
69
+ get_forward_msg: (params: {
70
+ id: string;
71
+ }) => Promise<ProtocolReplyOk<{
72
+ message: (ProtocolMessageSendSegment & {
73
+ data: {
74
+ name?: string;
75
+ uin?: string;
76
+ content?: ProtocolMessageSendSegment[];
77
+ };
78
+ })[];
79
+ }>>;
80
+ send_like: (params: {
81
+ user_id: number | string;
82
+ times?: number;
83
+ }) => Promise<ProtocolReplyOk<void>>;
84
+ set_msg_emoji_like: (params: {
85
+ message_id: number;
86
+ emoji_id: string;
87
+ set?: boolean;
88
+ }) => Promise<ProtocolReplyOk<void>>;
89
+ set_group_kick: (params: {
90
+ group_id: number | string;
91
+ user_id: number | string;
92
+ reject_add_request?: boolean;
93
+ }) => Promise<ProtocolReplyOk<void>>;
94
+ set_group_ban: (params: {
95
+ group_id: number | string;
96
+ user_id: number | string;
97
+ duration?: number;
98
+ }) => Promise<ProtocolReplyOk<void>>;
99
+ set_group_whole_ban: (params: {
100
+ group_id: number | string;
101
+ enable?: boolean;
102
+ }) => Promise<ProtocolReplyOk<void>>;
103
+ set_group_admin: (params: {
104
+ group_id: number | string;
105
+ user_id: number | string;
106
+ enable?: boolean;
107
+ }) => Promise<ProtocolReplyOk<void>>;
108
+ set_group_card: (params: {
109
+ group_id: number | string;
110
+ user_id: number | string;
111
+ card?: string;
112
+ }) => Promise<ProtocolReplyOk<void>>;
113
+ set_group_name: (params: {
114
+ group_id: number | string;
115
+ group_name: string;
116
+ }) => Promise<ProtocolReplyOk<void>>;
117
+ set_group_leave: (params: {
118
+ group_id: number | string;
119
+ is_dismiss?: boolean;
120
+ }) => Promise<ProtocolReplyOk<void>>;
121
+ set_group_special_title: (params: {
122
+ group_id: number | string;
123
+ user_id: number | string;
124
+ special_title?: string;
125
+ duration?: number;
126
+ }) => Promise<ProtocolReplyOk<void>>;
127
+ set_group_sign: (params: {
128
+ group_id: number | string;
129
+ }) => Promise<ProtocolReplyOk<void>>;
130
+ set_friend_add_request: (params: {
131
+ flag: string;
132
+ approve?: boolean;
133
+ remark?: string;
134
+ }) => Promise<ProtocolReplyOk<void>>;
135
+ delete_friend: (params: {
136
+ user_id: number | string;
137
+ temp_block?: boolean;
138
+ temp_both_del?: boolean;
139
+ }) => Promise<ProtocolReplyOk<void>>;
140
+ set_group_add_request: (params: {
141
+ flag: string;
142
+ sub_type?: 'add' | 'invite';
143
+ approve?: boolean;
144
+ reason?: string;
145
+ }) => Promise<ProtocolReplyOk<void>>;
146
+ get_login_info: () => Promise<ProtocolReplyOk<{
147
+ user_id: number;
148
+ nickname: string;
149
+ }>>;
150
+ get_stranger_info: (params: {
151
+ user_id: number | string;
152
+ no_cache?: boolean;
153
+ }) => Promise<ProtocolReplyOk<{
154
+ user_id: number;
155
+ nickname: string;
156
+ sex: 'male' | 'female' | 'unknown';
157
+ age: number;
158
+ }>>;
159
+ get_friend_list: () => Promise<ProtocolReplyOk<{
160
+ user_id: number;
161
+ nickname: string;
162
+ remark: string;
163
+ }[]>>;
164
+ get_group_info: (params: {
165
+ group_id: number | string;
166
+ no_cache?: boolean;
167
+ }) => Promise<ProtocolReplyOk<{
168
+ group_id: number;
169
+ group_name: string;
170
+ member_count: number;
171
+ max_member_count: number;
172
+ }>>;
173
+ get_group_list: (params?: {
174
+ no_cache?: boolean;
175
+ }) => Promise<ProtocolReplyOk<{
176
+ group_id: number;
177
+ group_name: string;
178
+ member_count: number;
179
+ max_member_count: number;
180
+ group_remark: string;
181
+ group_all_shut: number;
182
+ }[]>>;
183
+ get_group_member_info: (params: {
184
+ group_id: number | string;
185
+ user_id: number | string;
186
+ no_cache?: boolean;
187
+ }) => Promise<ProtocolReplyOk<{
188
+ group_id: number;
189
+ user_id: number;
190
+ nickname: string;
191
+ card: string;
192
+ sex: 'male' | 'female' | 'unknown';
193
+ age: number;
194
+ area: string;
195
+ join_time: number;
196
+ last_sent_time: number;
197
+ level: string;
198
+ role: 'owner' | 'admin' | 'member';
199
+ unfriendly: boolean;
200
+ title: string;
201
+ title_expire_time: number;
202
+ card_changeable: boolean;
203
+ }>>;
204
+ get_group_member_list: (params: {
205
+ group_id: number | string;
206
+ }) => Promise<ProtocolReplyOk<{
207
+ group_id: number;
208
+ user_id: number;
209
+ nickname: string;
210
+ card: string;
211
+ sex: 'male' | 'female' | 'unknown';
212
+ age: number;
213
+ area: string;
214
+ join_time: number;
215
+ last_sent_time: number;
216
+ level: string;
217
+ role: 'owner' | 'admin' | 'member';
218
+ unfriendly: boolean;
219
+ title: string;
220
+ title_expire_time: number;
221
+ card_changeable: boolean;
222
+ }[]>>;
223
+ get_group_honor_info: (params: {
224
+ group_id: number | string;
225
+ type: 'talkative' | 'performer' | 'legend' | 'strong_newbie' | 'emotion' | 'all';
226
+ }) => Promise<ProtocolReplyOk<{
227
+ group_id: number;
228
+ current_talkative?: {
229
+ user_id: number;
230
+ nickname: string;
231
+ avatar: string;
232
+ day_count: number;
233
+ };
234
+ talkative_list?: {
235
+ user_id: number;
236
+ nickname: string;
237
+ avatar: string;
238
+ day_count: number;
239
+ }[];
240
+ performer_list?: {
241
+ user_id: number;
242
+ nickname: string;
243
+ avatar: string;
244
+ day_count: number;
245
+ }[];
246
+ legend_list?: {
247
+ user_id: number;
248
+ nickname: string;
249
+ avatar: string;
250
+ day_count: number;
251
+ }[];
252
+ strong_newbie_list?: {
253
+ user_id: number;
254
+ nickname: string;
255
+ avatar: string;
256
+ day_count: number;
257
+ }[];
258
+ emotion_list?: {
259
+ user_id: number;
260
+ nickname: string;
261
+ avatar: string;
262
+ day_count: number;
263
+ }[];
264
+ }>>;
265
+ get_cookies: (params: {
266
+ domain: string;
267
+ }) => Promise<ProtocolReplyOk<{
268
+ cookies: string;
269
+ bkn: string;
270
+ }>>;
271
+ get_csrf_token: () => Promise<ProtocolReplyOk<{
272
+ token: number;
273
+ }>>;
274
+ get_credentials: (params: {
275
+ domain: string;
276
+ }) => Promise<ProtocolReplyOk<{
277
+ cookies: string;
278
+ token: number;
279
+ }>>;
280
+ get_record: (params: {
281
+ file: string;
282
+ out_format: string;
283
+ }) => Promise<ProtocolReplyOk<{
284
+ file: string;
285
+ url?: string;
286
+ }>>;
287
+ get_image: (params: {
288
+ file: string;
289
+ }) => Promise<ProtocolReplyOk<{
290
+ file: string;
291
+ url?: string;
292
+ }>>;
293
+ can_send_image: () => Promise<ProtocolReplyOk<{
294
+ yes: boolean;
295
+ }>>;
296
+ can_send_record: () => Promise<ProtocolReplyOk<{
297
+ yes: boolean;
298
+ }>>;
299
+ get_status: () => Promise<ProtocolReplyOk<{
300
+ online: boolean;
301
+ good: boolean;
302
+ }>>;
303
+ get_version_info: () => Promise<ProtocolReplyOk<{
304
+ app_name: string;
305
+ app_version: string;
306
+ protocol_version: string;
307
+ }>>;
308
+ clean_cache: () => Promise<ProtocolReplyOk<void>>;
309
+ _send_group_notice: (params: {
310
+ group_id: number | string;
311
+ content: string;
312
+ image?: string;
313
+ pinned?: number;
314
+ type?: number;
315
+ confirm_required?: number;
316
+ is_show_edit_card?: number;
317
+ tip_window_type?: number;
318
+ }) => Promise<ProtocolReplyOk<void>>;
319
+ _get_group_notice: (params: {
320
+ group_id: number | string;
321
+ }) => Promise<ProtocolReplyOk<{
322
+ sender_id: number;
323
+ publish_time: number;
324
+ notice_id: string;
325
+ message: {
326
+ text: string;
327
+ image: string[];
328
+ };
329
+ read_num: number;
330
+ }[]>>;
331
+ get_essence_msg_list: (params: {
332
+ group_id: number | string;
333
+ }) => Promise<ProtocolReplyOk<{
334
+ msg_seq: number;
335
+ msg_random: number;
336
+ sender_id: number;
337
+ sender_nick: string;
338
+ operator_id: number;
339
+ operator_nick: string;
340
+ message_id: number;
341
+ operator_time: number;
342
+ content: string[];
343
+ }[]>>;
344
+ set_essence_msg: (params: {
345
+ message_id: number;
346
+ }) => Promise<ProtocolReplyOk<void>>;
347
+ delete_essence_msg: (params: {
348
+ message_id: number;
349
+ }) => Promise<ProtocolReplyOk<void>>;
350
+ get_online_clients: (params?: {
351
+ no_cache?: boolean;
352
+ }) => Promise<ProtocolReplyOk<{
353
+ app_id: number;
354
+ device_name: string;
355
+ device_kind: string;
356
+ }[]>>;
357
+ ocr_image: (params: {
358
+ image: string;
359
+ }) => Promise<ProtocolReplyOk<{
360
+ texts: {
361
+ text: string;
362
+ coordinates: any[];
363
+ }[];
364
+ }>>;
365
+ translate_en2zh: (params: {
366
+ words: string[];
367
+ }) => Promise<ProtocolReplyOk<{
368
+ words: string[];
369
+ }>>;
370
+ get_robot_uin_range: () => Promise<ProtocolReplyOk<{
371
+ minUin: string;
372
+ maxUin: string;
373
+ }[]>>;
374
+ set_online_status: (params: {
375
+ status: number | string;
376
+ ext_status: number | string;
377
+ battery_status: number | string;
378
+ }) => Promise<ProtocolReplyOk<void>>;
379
+ upload_group_file: (params: {
380
+ group_id: number | string;
381
+ file: string;
382
+ name: string;
383
+ folder?: string;
384
+ folder_id?: string;
385
+ upload_file?: boolean;
386
+ }) => Promise<ProtocolReplyOk<{
387
+ file_id?: string;
388
+ }>>;
389
+ get_group_msg_history: (params: {
390
+ group_id: number | string;
391
+ message_seq?: string | number;
392
+ count?: number;
393
+ reverse_order?: boolean;
394
+ }) => Promise<ProtocolReplyOk<{
395
+ messages: any[];
396
+ }>>;
397
+ send_group_forward_msg: (params: {
398
+ group_id: number | string;
399
+ messages: any[];
400
+ }) => Promise<ProtocolReplyOk<{
401
+ message_id: number;
402
+ forward_id: string;
403
+ }>>;
404
+ mark_msg_as_read: (params: {
405
+ group_id?: number | string;
406
+ user_id?: number | string;
407
+ }) => Promise<ProtocolReplyOk<void>>;
408
+ upload_private_file: (params: {
409
+ user_id: number | string;
410
+ file: string;
411
+ name: string;
412
+ }) => Promise<ProtocolReplyOk<void>>;
413
+ get_file: (params: {
414
+ file: string;
415
+ file_id?: string;
416
+ }) => Promise<ProtocolReplyOk<{
417
+ file?: string;
418
+ url?: string;
419
+ file_size?: string;
420
+ file_name?: string;
421
+ base64?: string;
422
+ }>>;
423
+ handle_quick_operation: (params: {
424
+ context: Record<string, any>;
425
+ operation: Record<string, any>;
426
+ }) => Promise<ProtocolReplyOk<void>>;
427
+ get_group_file_url: (params: {
428
+ group_id: number | string;
429
+ file_id: string;
430
+ }) => Promise<ProtocolReplyOk<{
431
+ url: string;
432
+ }>>;
433
+ get_private_file_url: (params: {
434
+ user_id?: number | string;
435
+ file_id: string;
436
+ }) => Promise<ProtocolReplyOk<{
437
+ url: string;
438
+ }>>;
439
+ clean_stream_temp_file: (params: Record<string, never>) => Promise<ProtocolReplyOk<void>>;
440
+ del_group_album_media: (params: {
441
+ group_id: string | number;
442
+ album_id: string;
443
+ lloc: string;
444
+ }) => Promise<ProtocolReplyOk<{
445
+ result: any;
446
+ }>>;
447
+ set_group_album_media_like: (params: {
448
+ group_id: string | number;
449
+ album_id: string;
450
+ lloc: string;
451
+ id: string;
452
+ set?: boolean;
453
+ }) => Promise<ProtocolReplyOk<{
454
+ result: any;
455
+ }>>;
456
+ do_group_album_comment: (params: {
457
+ group_id: string | number;
458
+ album_id: string;
459
+ lloc: string;
460
+ content: string;
461
+ }) => Promise<ProtocolReplyOk<{
462
+ result: any;
463
+ }>>;
464
+ get_group_album_media_list: (params: {
465
+ group_id: string | number;
466
+ album_id: string;
467
+ attach_info?: string;
468
+ }) => Promise<ProtocolReplyOk<{
469
+ media_list: {
470
+ media_id: string;
471
+ url: string;
472
+ }[];
473
+ }>>;
474
+ get_qun_album_list: (params: {
475
+ group_id: string | number;
476
+ }) => Promise<ProtocolReplyOk<{
477
+ album_id: string;
478
+ album_name: string;
479
+ cover_url: string;
480
+ create_time: number;
481
+ }[]>>;
482
+ upload_image_to_qun_album: (params: {
483
+ group_id: string | number;
484
+ album_id: string;
485
+ album_name: string;
486
+ file: string;
487
+ }) => Promise<ProtocolReplyOk<{
488
+ result: any;
489
+ }>>;
490
+ set_group_add_option: (params: {
491
+ group_id: string | number;
492
+ add_type: number;
493
+ group_question?: string;
494
+ group_answer?: string;
495
+ }) => Promise<ProtocolReplyOk<void>>;
496
+ set_group_robot_add_option: (params: {
497
+ group_id: string | number;
498
+ robot_member_switch?: number;
499
+ robot_member_examine?: number;
500
+ }) => Promise<ProtocolReplyOk<void>>;
501
+ set_group_search: (params: {
502
+ group_id: string | number;
503
+ no_code_finger_open?: number;
504
+ no_finger_open?: number;
505
+ }) => Promise<ProtocolReplyOk<void>>;
506
+ get_group_info_ex: (params: {
507
+ group_id: string | number;
508
+ }) => Promise<ProtocolReplyOk<Record<string, any>>>;
509
+ set_group_todo: (params: {
510
+ group_id: string | number;
511
+ message_id: string;
512
+ message_seq?: string;
513
+ }) => Promise<ProtocolReplyOk<void>>;
514
+ group_poke: (params: {
515
+ group_id: string | number;
516
+ user_id: string | number;
517
+ target_id: string | number;
518
+ }) => Promise<ProtocolReplyOk<void>>;
519
+ set_group_kick_members: (params: {
520
+ group_id: string | number;
521
+ user_id: (string | number)[];
522
+ reject_add_request?: boolean;
523
+ }) => Promise<ProtocolReplyOk<void>>;
524
+ create_collection: (params: {
525
+ rawData: string;
526
+ brief: string;
527
+ }) => Promise<ProtocolReplyOk<{
528
+ result: number;
529
+ errMsg: string;
530
+ }>>;
531
+ set_self_longnick: (params: {
532
+ longNick: string;
533
+ }) => Promise<ProtocolReplyOk<void>>;
534
+ set_qq_avatar: (params: {
535
+ file: string;
536
+ }) => Promise<ProtocolReplyOk<void>>;
537
+ get_clientkey: () => Promise<ProtocolReplyOk<{
538
+ clientkey: string;
539
+ }>>;
540
+ get_ai_characters: (params: {
541
+ group_id: string | number;
542
+ chat_type?: number | string;
543
+ }) => Promise<ProtocolReplyOk<{
544
+ type: string;
545
+ characters: {
546
+ character_id: string;
547
+ character_name: string;
548
+ preview_url: string;
549
+ }[];
550
+ }[]>>;
551
+ set_doubt_friends_add_request: (params: {
552
+ flag: string;
553
+ approve?: boolean;
554
+ }) => Promise<ProtocolReplyOk<void>>;
555
+ get_doubt_friends_add_request: (params: {
556
+ count?: number;
557
+ }) => Promise<ProtocolReplyOk<{
558
+ user_id: number;
559
+ nickname: string;
560
+ age: number;
561
+ sex: string;
562
+ reason: string;
563
+ flag: string;
564
+ }[]>>;
565
+ nc_get_packet_status: () => Promise<ProtocolReplyOk<void>>;
566
+ set_restart: () => Promise<ProtocolReplyOk<void>>;
567
+ get_group_system_msg: (params: {
568
+ count?: number | string;
569
+ }) => Promise<ProtocolReplyOk<{
570
+ invited_requests: any[];
571
+ InvitedRequest: any[];
572
+ join_requests: any[];
573
+ }>>;
574
+ set_friend_remark: (params: {
575
+ user_id: string | number;
576
+ remark: string;
577
+ }) => Promise<ProtocolReplyOk<void>>;
578
+ get_recent_contact: (params: {
579
+ count?: number | string;
580
+ }) => Promise<ProtocolReplyOk<{
581
+ lastestMsg: any;
582
+ peerUin: string;
583
+ remark: string;
584
+ msgTime: string;
585
+ chatType: number;
586
+ msgId: string;
587
+ sendNickName: string;
588
+ sendMemberName: string;
589
+ peerName: string;
590
+ }[]>>;
591
+ get_rkey: () => Promise<ProtocolReplyOk<{
592
+ type: string;
593
+ rkey: string;
594
+ created_at: number;
595
+ ttl: number;
596
+ }[]>>;
597
+ get_rkey_server: () => Promise<ProtocolReplyOk<{
598
+ private_rkey: string;
599
+ group_rkey: string;
600
+ expired_time: number;
601
+ name: string;
602
+ }>>;
603
+ fetch_custom_face: (params: {
604
+ count?: number | string;
605
+ }) => Promise<ProtocolReplyOk<string[]>>;
606
+ nc_get_user_status: (params: {
607
+ user_id: string | number;
608
+ }) => Promise<ProtocolReplyOk<{
609
+ status: number;
610
+ ext_status: number;
611
+ }>>;
612
+ nc_get_rkey: () => Promise<ProtocolReplyOk<{
613
+ key: string;
614
+ expired: number;
615
+ }[]>>;
616
+ get_mini_app_ark: (params: Record<string, any>) => Promise<ProtocolReplyOk<{
617
+ data: {
618
+ ark: any;
619
+ };
620
+ }>>;
621
+ send_packet: (params: {
622
+ cmd: string;
623
+ data: string;
624
+ rsp?: boolean | string;
625
+ }) => Promise<ProtocolReplyOk<string | null>>;
626
+ bot_exit: () => Promise<ProtocolReplyOk<void>>;
627
+ get_collection_list: (params: {
628
+ category: string;
629
+ count?: string;
630
+ }) => Promise<ProtocolReplyOk<{
631
+ errCode: number;
632
+ errMsg: string;
633
+ collectionSearchList: {
634
+ collectionItemList: any[];
635
+ hasMore: boolean;
636
+ bottomTimeStamp: string;
637
+ };
638
+ }>>;
639
+ fetch_emoji_like: (params: {
640
+ message_id: number | string;
641
+ emojiId: number | string;
642
+ emojiType: number | string;
643
+ count?: number | string;
644
+ cookie?: string;
645
+ }) => Promise<ProtocolReplyOk<{
646
+ emojiLikesList: {
647
+ tinyId: string;
648
+ nickName: string;
649
+ headUrl: string;
650
+ }[];
651
+ cookie: string;
652
+ isLastPage: boolean;
653
+ isFirstPage: boolean;
654
+ result: number;
655
+ errMsg: string;
656
+ }>>;
657
+ get_emoji_likes: (params: {
658
+ group_id?: string;
659
+ message_id: string;
660
+ emoji_id: string;
661
+ emoji_type?: string;
662
+ count?: number;
663
+ }) => Promise<ProtocolReplyOk<{
664
+ emoji_like_list: {
665
+ user_id: string;
666
+ nick_name: string;
667
+ }[];
668
+ }>>;
669
+ ArkShareGroup: (params: {
670
+ group_id: string;
671
+ }) => Promise<ProtocolReplyOk<string>>;
672
+ ArkSharePeer: (params: {
673
+ user_id?: string;
674
+ group_id?: string;
675
+ phone_number?: string;
676
+ }) => Promise<ProtocolReplyOk<{
677
+ ark: any;
678
+ }>>;
679
+ click_inline_keyboard_button: (params: {
680
+ group_id: string;
681
+ bot_appid: string;
682
+ button_id?: string;
683
+ callback_data?: string;
684
+ msg_seq?: string;
685
+ }) => Promise<ProtocolReplyOk<void>>;
686
+ move_group_file: (params: {
687
+ group_id: string;
688
+ file_id: string;
689
+ current_parent_directory: string;
690
+ target_parent_directory: string;
691
+ }) => Promise<ProtocolReplyOk<{
692
+ ok: boolean;
693
+ }>>;
694
+ rename_group_file: (params: {
695
+ group_id: string;
696
+ file_id: string;
697
+ current_parent_directory: string;
698
+ new_name: string;
699
+ }) => Promise<ProtocolReplyOk<{
700
+ ok: boolean;
701
+ }>>;
702
+ trans_group_file: (params: {
703
+ group_id: string;
704
+ file_id: string;
705
+ }) => Promise<ProtocolReplyOk<{
706
+ ok: boolean;
707
+ }>>;
708
+ create_flash_task: (params: {
709
+ files: string[] | string;
710
+ name?: string;
711
+ thumb_path?: string;
712
+ }) => Promise<ProtocolReplyOk<{
713
+ task_id: string;
714
+ }>>;
715
+ get_flash_file_list: (params: {
716
+ fileset_id: string;
717
+ }) => Promise<ProtocolReplyOk<{
718
+ file_name: string;
719
+ size: number;
720
+ }[]>>;
721
+ get_flash_file_url: (params: {
722
+ fileset_id: string;
723
+ file_name?: string;
724
+ file_index?: number;
725
+ }) => Promise<ProtocolReplyOk<{
726
+ url: string;
727
+ }>>;
728
+ send_flash_msg: (params: {
729
+ fileset_id: string;
730
+ user_id?: string;
731
+ group_id?: string;
732
+ }) => Promise<ProtocolReplyOk<{
733
+ message_id: number;
734
+ }>>;
735
+ get_share_link: (params: {
736
+ fileset_id: string;
737
+ }) => Promise<ProtocolReplyOk<string>>;
738
+ get_fileset_info: (params: {
739
+ fileset_id: string;
740
+ }) => Promise<ProtocolReplyOk<{
741
+ fileset_id: string;
742
+ file_list: any[];
743
+ }>>;
744
+ get_online_file_msg: (params: {
745
+ user_id: string;
746
+ }) => Promise<ProtocolReplyOk<void>>;
747
+ send_online_file: (params: {
748
+ user_id: string;
749
+ file_path: string;
750
+ file_name?: string;
751
+ }) => Promise<ProtocolReplyOk<void>>;
752
+ send_online_folder: (params: {
753
+ user_id: string;
754
+ folder_path: string;
755
+ folder_name?: string;
756
+ }) => Promise<ProtocolReplyOk<void>>;
757
+ receive_online_file: (params: {
758
+ user_id: string;
759
+ msg_id: string;
760
+ element_id: string;
761
+ }) => Promise<ProtocolReplyOk<void>>;
762
+ refuse_online_file: (params: {
763
+ user_id: string;
764
+ msg_id: string;
765
+ element_id: string;
766
+ }) => Promise<ProtocolReplyOk<void>>;
767
+ cancel_online_file: (params: {
768
+ user_id: string;
769
+ msg_id: string;
770
+ }) => Promise<ProtocolReplyOk<void>>;
771
+ download_fileset: (params: {
772
+ fileset_id: string;
773
+ }) => Promise<ProtocolReplyOk<void>>;
774
+ get_fileset_id: (params: {
775
+ share_code: string;
776
+ }) => Promise<ProtocolReplyOk<{
777
+ fileset_id: string;
778
+ }>>;
779
+ get_friends_with_category: () => Promise<ProtocolReplyOk<{
780
+ categoryId: number;
781
+ categoryName: string;
782
+ categoryMbCount: number;
783
+ buddyList: any[];
784
+ }[]>>;
785
+ get_profile_like: (params: {
786
+ user_id: string;
787
+ start?: number | string;
788
+ count?: number | string;
789
+ }) => Promise<ProtocolReplyOk<{
790
+ uid: string;
791
+ time: string;
792
+ favoriteInfo: any;
793
+ voteInfo: any;
794
+ }>>;
795
+ set_diy_online_status: (params: {
796
+ face_id: number | string;
797
+ face_type: number | string;
798
+ wording: string;
799
+ }) => Promise<ProtocolReplyOk<string>>;
800
+ get_unidirectional_friend_list: () => Promise<ProtocolReplyOk<{
801
+ uin: number;
802
+ uid: string;
803
+ nick_name: string;
804
+ age: number;
805
+ source: string;
806
+ }[]>>;
807
+ get_guild_list: () => Promise<ProtocolReplyOk<{
808
+ guild_id: string;
809
+ guild_name: string;
810
+ }[]>>;
811
+ get_guild_service_profile: (params: {
812
+ guild_id: string;
813
+ }) => Promise<ProtocolReplyOk<{
814
+ guild_id: string;
815
+ guild_name: string;
816
+ guild_display_id: string;
817
+ }>>;
818
+ get_ai_record: (params: {
819
+ character: string;
820
+ group_id: string;
821
+ text: string;
822
+ }) => Promise<ProtocolReplyOk<string>>;
823
+ send_group_ai_record: (params: {
824
+ character: string;
825
+ group_id: string;
826
+ text: string;
827
+ }) => Promise<ProtocolReplyOk<void>>;
828
+ set_group_remark: (params: {
829
+ group_id: number | string;
830
+ remark: string;
831
+ }) => Promise<ProtocolReplyOk<void>>;
832
+ get_group_ignored_notifies: (params?: {
833
+ group_id?: number | string;
834
+ }) => Promise<ProtocolReplyOk<{
835
+ invited_requests?: any[];
836
+ InvitedRequest?: any[];
837
+ join_requests?: any[];
838
+ }>>;
839
+ _del_group_notice: (params: {
840
+ group_id: number | string;
841
+ notice_id: string;
842
+ }) => Promise<ProtocolReplyOk<void>>;
843
+ get_group_shut_list: (params: {
844
+ group_id: number | string;
845
+ }) => Promise<ProtocolReplyOk<{
846
+ user_id: number;
847
+ nickname: string;
848
+ shut_up_time: number;
849
+ }[]>>;
850
+ set_input_status: (params: {
851
+ user_id: number | string;
852
+ event_type: number;
853
+ }) => Promise<ProtocolReplyOk<void>>;
854
+ set_qq_profile: (params: {
855
+ nickname: string;
856
+ personal_note?: string;
857
+ sex?: number | string;
858
+ }) => Promise<ProtocolReplyOk<void>>;
859
+ get_group_root_files: (params: {
860
+ group_id: number | string;
861
+ file_count?: number;
862
+ }) => Promise<ProtocolReplyOk<{
863
+ files: any[];
864
+ folders: any[];
865
+ }>>;
866
+ check_url_safely: (params: {
867
+ url: string;
868
+ }) => Promise<ProtocolReplyOk<{
869
+ level: number;
870
+ }>>;
871
+ get_group_at_all_remain: (params: {
872
+ group_id: number | string;
873
+ }) => Promise<ProtocolReplyOk<{
874
+ can_at_all: boolean;
875
+ remain_at_all_count_for_group: number;
876
+ remain_at_all_count_for_uin: number;
877
+ }>>;
878
+ send_forward_msg: (params: {
879
+ message_type?: 'private' | 'group';
880
+ user_id?: number | string;
881
+ group_id?: number | string;
882
+ message: any;
883
+ auto_escape?: boolean;
884
+ source?: string;
885
+ news?: any[];
886
+ summary?: string;
887
+ prompt?: string;
888
+ }) => Promise<ProtocolReplyOk<{
889
+ message_id: number;
890
+ res_id: string;
891
+ forward_id: string;
892
+ }>>;
893
+ send_private_forward_msg: (params: {
894
+ user_id: number | string;
895
+ message: any;
896
+ auto_escape?: boolean;
897
+ source?: string;
898
+ news?: any[];
899
+ summary?: string;
900
+ prompt?: string;
901
+ }) => Promise<ProtocolReplyOk<{
902
+ message_id: number;
903
+ res_id: string;
904
+ forward_id: string;
905
+ }>>;
906
+ download_file: (params: {
907
+ url: string;
908
+ base64?: string;
909
+ name?: string;
910
+ headers?: string | string[];
911
+ }) => Promise<ProtocolReplyOk<{
912
+ file: string;
913
+ }>>;
914
+ get_friend_msg_history: (params: {
915
+ user_id: number | string;
916
+ message_seq?: number | string;
917
+ count?: number;
918
+ reverse_order?: boolean;
919
+ disable_get_url?: boolean;
920
+ parse_mult_msg?: boolean;
921
+ quick_reply?: boolean;
922
+ }) => Promise<ProtocolReplyOk<{
923
+ messages: any[];
924
+ }>>;
925
+ set_group_portrait: (params: {
926
+ group_id: number | string;
927
+ file: string;
928
+ }) => Promise<ProtocolReplyOk<{
929
+ result: number;
930
+ errMsg: string;
931
+ }>>;
932
+ _get_model_show: (params: {
933
+ model: string;
934
+ }) => Promise<ProtocolReplyOk<{
935
+ variants: {
936
+ model_show: string;
937
+ need_pay: boolean;
938
+ }[];
939
+ }>>;
940
+ _set_model_show: (params: {
941
+ model: string;
942
+ model_show: string;
943
+ }) => Promise<ProtocolReplyOk<void>>;
944
+ delete_group_file: (params: {
945
+ group_id: number | string;
946
+ file_id: string;
947
+ }) => Promise<ProtocolReplyOk<void>>;
948
+ create_group_file_folder: (params: {
949
+ group_id: number | string;
950
+ folder_name: string;
951
+ name?: string;
952
+ }) => Promise<ProtocolReplyOk<{
953
+ result: any;
954
+ groupItem: any;
955
+ }>>;
956
+ delete_group_folder: (params: {
957
+ group_id: number | string;
958
+ folder_id: string;
959
+ }) => Promise<ProtocolReplyOk<void>>;
960
+ get_group_file_system_info: (params: {
961
+ group_id: number | string;
962
+ }) => Promise<ProtocolReplyOk<{
963
+ file_count: number;
964
+ limit_count: number;
965
+ used_space: number;
966
+ total_space: number;
967
+ }>>;
968
+ get_group_files_by_folder: (params: {
969
+ group_id: number | string;
970
+ folder_id: string;
971
+ file_count?: number;
972
+ }) => Promise<ProtocolReplyOk<{
973
+ files: any[];
974
+ folders: any[];
975
+ }>>;
976
+ forward_friend_single_msg: (params: {
977
+ message_id: number | string;
978
+ group_id?: number | string;
979
+ user_id: number | string;
980
+ }) => Promise<ProtocolReplyOk<void>>;
981
+ forward_group_single_msg: (params: {
982
+ message_id: number | string;
983
+ group_id: number | string;
984
+ user_id?: number | string;
985
+ }) => Promise<ProtocolReplyOk<void>>;
986
+ mark_group_msg_as_read: (params: {
987
+ user_id?: number | string;
988
+ group_id: number | string;
989
+ message_id?: number | string;
990
+ }) => Promise<ProtocolReplyOk<void>>;
991
+ mark_private_msg_as_read: (params: {
992
+ user_id: number | string;
993
+ group_id?: number | string;
994
+ message_id?: number | string;
995
+ }) => Promise<ProtocolReplyOk<void>>;
996
+ _mark_all_as_read: () => Promise<ProtocolReplyOk<void>>;
997
+ send_poke: (params: {
998
+ user_id: number | string;
999
+ group_id?: number | string;
1000
+ target_id?: number | string;
1001
+ }) => Promise<ProtocolReplyOk<void>>;
1002
+ upload_file_stream: (params: {
1003
+ stream_id: string;
1004
+ chunk_data?: string;
1005
+ chunk_index?: number;
1006
+ total_chunks?: number;
1007
+ file_size?: number;
1008
+ expected_sha256?: string;
1009
+ is_complete?: boolean;
1010
+ filename?: string;
1011
+ reset?: boolean;
1012
+ verify_only?: boolean;
1013
+ file_retention?: number;
1014
+ }) => Promise<ProtocolReplyOk<{
1015
+ type: string;
1016
+ stream_id: string;
1017
+ status: string;
1018
+ received_chunks: number;
1019
+ total_chunks: number;
1020
+ }>>;
1021
+ }
1022
+ interface ClientStreamMethods {
1023
+ download_file_record_stream: (params: {
1024
+ file: string;
1025
+ file_id?: string;
1026
+ chunk_size?: number;
1027
+ out_format?: string;
1028
+ }) => Promise<ConnectionStreamResult<{
1029
+ file: string;
1030
+ }>>;
1031
+ download_file_image_stream: (params: {
1032
+ file: string;
1033
+ file_id?: string;
1034
+ chunk_size?: number;
1035
+ }) => Promise<ConnectionStreamResult<{
1036
+ file: string;
1037
+ }>>;
1038
+ test_download_stream: (params: {
1039
+ error?: boolean;
1040
+ }) => Promise<ConnectionStreamResult<{
1041
+ success: boolean;
1042
+ }>>;
1043
+ download_file_stream: (params: {
1044
+ file: string;
1045
+ file_id?: string;
1046
+ chunk_size?: number;
1047
+ }) => Promise<ConnectionStreamResult<{
1048
+ type: string;
1049
+ data_type: string;
1050
+ file_name: string;
1051
+ file_size: number;
1052
+ }>>;
1053
+ }
1054
+ declare function sendRequest<const T extends keyof ClientMethods>(conn: Connection, method: T, ...params: Parameters<ClientMethods[T]>): ReturnType<ClientMethods[T]>;
1055
+ declare function sendRequest(conn: Connection, method: string, ...params: any[]): Promise<ProtocolReplyOk<any>>;
1056
+ declare function sendRequestStream<const T extends keyof ClientStreamMethods>(conn: Connection, method: T, ...params: Parameters<ClientStreamMethods[T]>): ReturnType<ClientStreamMethods[T]>;
1057
+ declare function sendRequestStream(conn: Connection, method: string, ...params: any[]): Promise<ConnectionStreamResult<any>>;
1058
+ type SendRequestResult<T extends keyof ClientMethods> = Awaited<ReturnType<ClientMethods[T]>>;
1059
+ type SendRequestStreamResult<T extends keyof ClientStreamMethods> = Awaited<ReturnType<ClientStreamMethods[T]>>;
1060
+ //#endregion
1061
+ //#region src/utils/value.d.ts
1062
+ declare function isSameNumericId(id1: string | number, id2: string | number): boolean;
1063
+ declare function isNull(value: any): value is null | undefined;
1064
+ declare class NumericSet implements Iterable<string> {
1065
+ private _size;
1066
+ private _record;
1067
+ constructor(ids?: Iterable<string | number>);
1068
+ clear(): void;
1069
+ has(id: string | number): boolean;
1070
+ remove(id: string | number): boolean;
1071
+ add(id: string | number): this;
1072
+ get size(): number;
1073
+ [Symbol.iterator](): IterableIterator<string>;
1074
+ static split(str?: string, sep?: string): NumericSet;
1075
+ }
1076
+ declare const noop: () => void;
1077
+ //#endregion
1078
+ export { ClientMethods, ClientStreamMethods, ConnectionOrProtocolEventHandlers, EventMatcher, NumericSet, SendRequestResult, SendRequestStreamResult, createEventMatcher, createMessageSegment, defineHandler, findMessageSegment, isMessageSegment, isNull, isSameNumericId, matchEvent, matchEvent as when, noop, sendRequest, sendRequestStream };
1079
+ //# sourceMappingURL=index.d.mts.map