@shhhum/simplex-chat 0.0.0-placeholder → 7.1.0-beta.6.1

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.
Files changed (105) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +130 -0
  3. package/dist/api.d.ts +439 -0
  4. package/dist/api.js +911 -0
  5. package/dist/api.js.map +1 -0
  6. package/dist/bot.d.ts +34 -0
  7. package/dist/bot.js +194 -0
  8. package/dist/bot.js.map +1 -0
  9. package/dist/cli.d.ts +4 -0
  10. package/dist/cli.js +46 -0
  11. package/dist/cli.js.map +1 -0
  12. package/dist/core.d.ts +138 -0
  13. package/dist/core.js +144 -0
  14. package/dist/core.js.map +1 -0
  15. package/dist/index.d.ts +19 -0
  16. package/dist/index.js +23 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/libs.d.ts +12 -0
  19. package/dist/libs.js +210 -0
  20. package/dist/libs.js.map +1 -0
  21. package/dist/release.d.ts +5 -0
  22. package/dist/release.js +20 -0
  23. package/dist/release.js.map +1 -0
  24. package/dist/simplex.d.ts +12 -0
  25. package/dist/simplex.js +22 -0
  26. package/dist/util.d.ts +15 -0
  27. package/dist/util.js +91 -0
  28. package/dist/util.js.map +1 -0
  29. package/docs/Namespace.api.md +33 -0
  30. package/docs/Namespace.bot.md +24 -0
  31. package/docs/Namespace.core.md +50 -0
  32. package/docs/Namespace.util.md +25 -0
  33. package/docs/README.md +12 -0
  34. package/docs/api.Class.ChatApi.md +1851 -0
  35. package/docs/api.Class.ChatCommandError.md +205 -0
  36. package/docs/api.Enumeration.ConnReqType.md +27 -0
  37. package/docs/api.Interface.BotAddressSettings.md +60 -0
  38. package/docs/api.TypeAlias.DbConfig.md +62 -0
  39. package/docs/api.TypeAlias.EventSubscriberFunc.md +31 -0
  40. package/docs/api.TypeAlias.EventSubscribers.md +11 -0
  41. package/docs/api.Variable.defaultBotAddressSettings.md +11 -0
  42. package/docs/bot.Function.run.md +21 -0
  43. package/docs/bot.Function.subscribeChatItems.md +27 -0
  44. package/docs/bot.Interface.BotConfig.md +87 -0
  45. package/docs/bot.Interface.BotOptions.md +81 -0
  46. package/docs/bot.TypeAlias.BotDbOpts.md +21 -0
  47. package/docs/core.Class.ChatAPIError.md +205 -0
  48. package/docs/core.Class.ChatInitError.md +205 -0
  49. package/docs/core.DBMigrationError.Interface.ErrorMigration.md +41 -0
  50. package/docs/core.DBMigrationError.Interface.ErrorNotADatabase.md +33 -0
  51. package/docs/core.DBMigrationError.Interface.ErrorSQL.md +41 -0
  52. package/docs/core.DBMigrationError.Interface.InvalidConfirmation.md +25 -0
  53. package/docs/core.DBMigrationError.Interface.InvalidQueueSize.md +25 -0
  54. package/docs/core.DBMigrationError.TypeAlias.Tag.md +11 -0
  55. package/docs/core.Enumeration.MigrationConfirmation.md +43 -0
  56. package/docs/core.Function.chatCloseStore.md +23 -0
  57. package/docs/core.Function.chatDecryptFile.md +31 -0
  58. package/docs/core.Function.chatEncryptFile.md +31 -0
  59. package/docs/core.Function.chatMigrateInit.md +37 -0
  60. package/docs/core.Function.chatReadFile.md +27 -0
  61. package/docs/core.Function.chatRecvMsgWait.md +27 -0
  62. package/docs/core.Function.chatSendCmd.md +27 -0
  63. package/docs/core.Function.chatWriteFile.md +31 -0
  64. package/docs/core.Function.loadLibrary.md +24 -0
  65. package/docs/core.Interface.APIResult.md +31 -0
  66. package/docs/core.Interface.CryptoArgs.md +27 -0
  67. package/docs/core.Interface.UpMigration.md +25 -0
  68. package/docs/core.MTRError.Interface.MTREDifferent.md +33 -0
  69. package/docs/core.MTRError.Interface.MTRENoDown.md +33 -0
  70. package/docs/core.MTRError.TypeAlias.Tag.md +11 -0
  71. package/docs/core.MigrationError.Interface.MEDowngrade.md +33 -0
  72. package/docs/core.MigrationError.Interface.MEUpgrade.md +33 -0
  73. package/docs/core.MigrationError.Interface.MigrationError.md +33 -0
  74. package/docs/core.MigrationError.TypeAlias.Tag.md +11 -0
  75. package/docs/core.Namespace.DBMigrationError.md +19 -0
  76. package/docs/core.Namespace.MTRError.md +16 -0
  77. package/docs/core.Namespace.MigrationError.md +17 -0
  78. package/docs/core.TypeAlias.Backend.md +11 -0
  79. package/docs/core.TypeAlias.DBMigrationError.md +11 -0
  80. package/docs/core.TypeAlias.MTRError.md +11 -0
  81. package/docs/core.TypeAlias.MigrationError.md +11 -0
  82. package/docs/util.Function.botAddressSettings.md +21 -0
  83. package/docs/util.Function.chatInfoName.md +21 -0
  84. package/docs/util.Function.chatInfoRef.md +21 -0
  85. package/docs/util.Function.ciBotCommand.md +21 -0
  86. package/docs/util.Function.ciContentText.md +21 -0
  87. package/docs/util.Function.contactAddressStr.md +21 -0
  88. package/docs/util.Function.fromLocalProfile.md +21 -0
  89. package/docs/util.Function.reactionText.md +21 -0
  90. package/docs/util.Function.senderName.md +25 -0
  91. package/docs/util.Interface.BotCommand.md +25 -0
  92. package/examples/squaring-bot-readme.js +17 -0
  93. package/examples/squaring-bot.ts +42 -0
  94. package/package.json +52 -6
  95. package/src/api.ts +997 -0
  96. package/src/bot.ts +221 -0
  97. package/src/cli.ts +42 -0
  98. package/src/core.ts +240 -0
  99. package/src/index.ts +22 -0
  100. package/src/libs.ts +202 -0
  101. package/src/release.ts +19 -0
  102. package/src/simplex.d.ts +12 -0
  103. package/src/simplex.js +22 -0
  104. package/src/util.ts +92 -0
  105. package/tsconfig.json +23 -0
@@ -0,0 +1,1851 @@
1
+ [**simplex-chat**](README.md)
2
+
3
+ ***
4
+
5
+ [simplex-chat](README.md) / [api](Namespace.api.md) / ChatApi
6
+
7
+ # Class: ChatApi
8
+
9
+ Defined in: [src/api.ts:95](../src/api.ts#L95)
10
+
11
+ Main API class for interacting with the chat core library.
12
+
13
+ ## Properties
14
+
15
+ ### ctrl\_
16
+
17
+ > `protected` **ctrl\_**: `bigint` \| `undefined`
18
+
19
+ Defined in: [src/api.ts:101](../src/api.ts#L101)
20
+
21
+ ## Accessors
22
+
23
+ ### ctrl
24
+
25
+ #### Get Signature
26
+
27
+ > **get** **ctrl**(): `bigint`
28
+
29
+ Defined in: [src/api.ts:343](../src/api.ts#L343)
30
+
31
+ Chat controller reference
32
+
33
+ ##### Returns
34
+
35
+ `bigint`
36
+
37
+ ***
38
+
39
+ ### initialized
40
+
41
+ #### Get Signature
42
+
43
+ > **get** **initialized**(): `boolean`
44
+
45
+ Defined in: [src/api.ts:329](../src/api.ts#L329)
46
+
47
+ Chat controller is initialized
48
+
49
+ ##### Returns
50
+
51
+ `boolean`
52
+
53
+ ***
54
+
55
+ ### started
56
+
57
+ #### Get Signature
58
+
59
+ > **get** **started**(): `boolean`
60
+
61
+ Defined in: [src/api.ts:336](../src/api.ts#L336)
62
+
63
+ Chat controller is started
64
+
65
+ ##### Returns
66
+
67
+ `boolean`
68
+
69
+ ## Methods
70
+
71
+ ### apiAcceptContactRequest()
72
+
73
+ > **apiAcceptContactRequest**(`contactReqId`): `Promise`\<`Contact`\>
74
+
75
+ Defined in: [src/api.ts:770](../src/api.ts#L770)
76
+
77
+ Accept contact request.
78
+ Network usage: interactive.
79
+
80
+ #### Parameters
81
+
82
+ ##### contactReqId
83
+
84
+ `number`
85
+
86
+ #### Returns
87
+
88
+ `Promise`\<`Contact`\>
89
+
90
+ ***
91
+
92
+ ### apiAcceptMember()
93
+
94
+ > **apiAcceptMember**(`groupId`, `groupMemberId`, `memberRole`): `Promise`\<`GroupMember`\>
95
+
96
+ Defined in: [src/api.ts:590](../src/api.ts#L590)
97
+
98
+ Accept group member. Requires Admin role.
99
+ Network usage: background.
100
+
101
+ #### Parameters
102
+
103
+ ##### groupId
104
+
105
+ `number`
106
+
107
+ ##### groupMemberId
108
+
109
+ `number`
110
+
111
+ ##### memberRole
112
+
113
+ `GroupMemberRole`
114
+
115
+ #### Returns
116
+
117
+ `Promise`\<`GroupMember`\>
118
+
119
+ ***
120
+
121
+ ### apiAddMember()
122
+
123
+ > **apiAddMember**(`groupId`, `contactId`, `memberRole`): `Promise`\<`GroupMember`\>
124
+
125
+ Defined in: [src/api.ts:560](../src/api.ts#L560)
126
+
127
+ Add contact to group. Requires bot to have Admin role.
128
+ Network usage: interactive.
129
+
130
+ #### Parameters
131
+
132
+ ##### groupId
133
+
134
+ `number`
135
+
136
+ ##### contactId
137
+
138
+ `number`
139
+
140
+ ##### memberRole
141
+
142
+ `GroupMemberRole`
143
+
144
+ #### Returns
145
+
146
+ `Promise`\<`GroupMember`\>
147
+
148
+ ***
149
+
150
+ ### apiAddMemberViaGroup()
151
+
152
+ > **apiAddMemberViaGroup**(`groupId`, `viaGroupId`, `groupMemberId`, `memberRole`): `Promise`\<`GroupMember`\>
153
+
154
+ Defined in: [src/api.ts:570](../src/api.ts#L570)
155
+
156
+ Add member of another group to group. Requires bot to have Admin role in the group, and direct messages allowed for its role in another group.
157
+ Network usage: interactive.
158
+
159
+ #### Parameters
160
+
161
+ ##### groupId
162
+
163
+ `number`
164
+
165
+ ##### viaGroupId
166
+
167
+ `number`
168
+
169
+ ##### groupMemberId
170
+
171
+ `number`
172
+
173
+ ##### memberRole
174
+
175
+ `GroupMemberRole`
176
+
177
+ #### Returns
178
+
179
+ `Promise`\<`GroupMember`\>
180
+
181
+ ***
182
+
183
+ ### apiBlockMembersForAll()
184
+
185
+ > **apiBlockMembersForAll**(`groupId`, `groupMemberIds`, `blocked`): `Promise`\<`void`\>
186
+
187
+ Defined in: [src/api.ts:610](../src/api.ts#L610)
188
+
189
+ Block members. Requires Moderator role.
190
+ Network usage: background.
191
+
192
+ #### Parameters
193
+
194
+ ##### groupId
195
+
196
+ `number`
197
+
198
+ ##### groupMemberIds
199
+
200
+ `number`[]
201
+
202
+ ##### blocked
203
+
204
+ `boolean`
205
+
206
+ #### Returns
207
+
208
+ `Promise`\<`void`\>
209
+
210
+ ***
211
+
212
+ ### apiCancelFile()
213
+
214
+ > **apiCancelFile**(`fileId`): `Promise`\<`void`\>
215
+
216
+ Defined in: [src/api.ts:550](../src/api.ts#L550)
217
+
218
+ Cancel file.
219
+ Network usage: background.
220
+
221
+ #### Parameters
222
+
223
+ ##### fileId
224
+
225
+ `number`
226
+
227
+ #### Returns
228
+
229
+ `Promise`\<`void`\>
230
+
231
+ ***
232
+
233
+ ### apiChatItemReaction()
234
+
235
+ > **apiChatItemReaction**(`chatType`, `chatId`, `chatItemId`, `add`, `reaction`): `Promise`\<`ACIReaction`\>
236
+
237
+ Defined in: [src/api.ts:523](../src/api.ts#L523)
238
+
239
+ Add/remove message reaction.
240
+ Network usage: background.
241
+
242
+ #### Parameters
243
+
244
+ ##### chatType
245
+
246
+ `ChatType`
247
+
248
+ ##### chatId
249
+
250
+ `number`
251
+
252
+ ##### chatItemId
253
+
254
+ `number`
255
+
256
+ ##### add
257
+
258
+ `boolean`
259
+
260
+ ##### reaction
261
+
262
+ `MsgReaction`
263
+
264
+ #### Returns
265
+
266
+ `Promise`\<`ACIReaction`\>
267
+
268
+ ***
269
+
270
+ ### apiConnect()
271
+
272
+ > **apiConnect**(`userId`, `incognito`, `preparedLink`): `Promise`\<[`ConnReqType`](api.Enumeration.ConnReqType.md)\>
273
+
274
+ Defined in: [src/api.ts:739](../src/api.ts#L739)
275
+
276
+ Connect via prepared SimpleX link. The link can be 1-time invitation link, contact address or group link
277
+ Network usage: interactive.
278
+
279
+ #### Parameters
280
+
281
+ ##### userId
282
+
283
+ `number`
284
+
285
+ ##### incognito
286
+
287
+ `boolean`
288
+
289
+ ##### preparedLink
290
+
291
+ `CreatedConnLink`
292
+
293
+ #### Returns
294
+
295
+ `Promise`\<[`ConnReqType`](api.Enumeration.ConnReqType.md)\>
296
+
297
+ ***
298
+
299
+ ### apiConnectActiveUser()
300
+
301
+ > **apiConnectActiveUser**(`connLink`): `Promise`\<[`ConnReqType`](api.Enumeration.ConnReqType.md)\>
302
+
303
+ Defined in: [src/api.ts:748](../src/api.ts#L748)
304
+
305
+ Connect via SimpleX link as string in the active user profile.
306
+ Network usage: interactive.
307
+
308
+ #### Parameters
309
+
310
+ ##### connLink
311
+
312
+ `string`
313
+
314
+ #### Returns
315
+
316
+ `Promise`\<[`ConnReqType`](api.Enumeration.ConnReqType.md)\>
317
+
318
+ ***
319
+
320
+ ### apiConnectPlan()
321
+
322
+ > **apiConnectPlan**(`userId`, `connectionLink`): `Promise`\<\[`ConnectionPlan`, `CreatedConnLink`\]\>
323
+
324
+ Defined in: [src/api.ts:729](../src/api.ts#L729)
325
+
326
+ Determine SimpleX link type and if the bot is already connected via this link.
327
+ Network usage: interactive.
328
+
329
+ #### Parameters
330
+
331
+ ##### userId
332
+
333
+ `number`
334
+
335
+ ##### connectionLink
336
+
337
+ `string`
338
+
339
+ #### Returns
340
+
341
+ `Promise`\<\[`ConnectionPlan`, `CreatedConnLink`\]\>
342
+
343
+ ***
344
+
345
+ ### apiCreateActiveUser()
346
+
347
+ > **apiCreateActiveUser**(`profile?`): `Promise`\<`User`\>
348
+
349
+ Defined in: [src/api.ts:907](../src/api.ts#L907)
350
+
351
+ Create new user profile
352
+ Network usage: no.
353
+
354
+ #### Parameters
355
+
356
+ ##### profile?
357
+
358
+ `Profile`
359
+
360
+ #### Returns
361
+
362
+ `Promise`\<`User`\>
363
+
364
+ ***
365
+
366
+ ### apiCreateGroupLink()
367
+
368
+ > **apiCreateGroupLink**(`groupId`, `memberRole`): `Promise`\<`string`\>
369
+
370
+ Defined in: [src/api.ts:670](../src/api.ts#L670)
371
+
372
+ Create group link.
373
+ Network usage: interactive.
374
+
375
+ #### Parameters
376
+
377
+ ##### groupId
378
+
379
+ `number`
380
+
381
+ ##### memberRole
382
+
383
+ `GroupMemberRole`
384
+
385
+ #### Returns
386
+
387
+ `Promise`\<`string`\>
388
+
389
+ ***
390
+
391
+ ### apiCreateLink()
392
+
393
+ > **apiCreateLink**(`userId`): `Promise`\<`string`\>
394
+
395
+ Defined in: [src/api.ts:716](../src/api.ts#L716)
396
+
397
+ Create 1-time invitation link.
398
+ Network usage: interactive.
399
+
400
+ #### Parameters
401
+
402
+ ##### userId
403
+
404
+ `number`
405
+
406
+ #### Returns
407
+
408
+ `Promise`\<`string`\>
409
+
410
+ ***
411
+
412
+ ### apiCreateMemberContact()
413
+
414
+ > **apiCreateMemberContact**(`groupId`, `groupMemberId`): `Promise`\<`Contact`\>
415
+
416
+ Defined in: [src/api.ts:973](../src/api.ts#L973)
417
+
418
+ Create a direct message contact with a group member.
419
+ Returns the created contact.
420
+ Network usage: interactive.
421
+
422
+ #### Parameters
423
+
424
+ ##### groupId
425
+
426
+ `number`
427
+
428
+ ##### groupMemberId
429
+
430
+ `number`
431
+
432
+ #### Returns
433
+
434
+ `Promise`\<`Contact`\>
435
+
436
+ ***
437
+
438
+ ### apiCreateUserAddress()
439
+
440
+ > **apiCreateUserAddress**(`userId`): `Promise`\<`CreatedConnLink`\>
441
+
442
+ Defined in: [src/api.ts:360](../src/api.ts#L360)
443
+
444
+ Create bot address.
445
+ Network usage: interactive.
446
+
447
+ #### Parameters
448
+
449
+ ##### userId
450
+
451
+ `number`
452
+
453
+ #### Returns
454
+
455
+ `Promise`\<`CreatedConnLink`\>
456
+
457
+ ***
458
+
459
+ ### apiDeleteChat()
460
+
461
+ > **apiDeleteChat**(`chatType`, `chatId`, `deleteMode?`): `Promise`\<`void`\>
462
+
463
+ Defined in: [src/api.ts:829](../src/api.ts#L829)
464
+
465
+ Delete chat.
466
+ Network usage: background.
467
+
468
+ #### Parameters
469
+
470
+ ##### chatType
471
+
472
+ `ChatType`
473
+
474
+ ##### chatId
475
+
476
+ `number`
477
+
478
+ ##### deleteMode?
479
+
480
+ `ChatDeleteMode` = `...`
481
+
482
+ #### Returns
483
+
484
+ `Promise`\<`void`\>
485
+
486
+ ***
487
+
488
+ ### apiDeleteChatItems()
489
+
490
+ > **apiDeleteChatItems**(`chatType`, `chatId`, `chatItemIds`, `deleteMode`): `Promise`\<`ChatItemDeletion`[]\>
491
+
492
+ Defined in: [src/api.ts:498](../src/api.ts#L498)
493
+
494
+ Delete message.
495
+ Network usage: background.
496
+
497
+ #### Parameters
498
+
499
+ ##### chatType
500
+
501
+ `ChatType`
502
+
503
+ ##### chatId
504
+
505
+ `number`
506
+
507
+ ##### chatItemIds
508
+
509
+ `number`[]
510
+
511
+ ##### deleteMode
512
+
513
+ `CIDeleteMode`
514
+
515
+ #### Returns
516
+
517
+ `Promise`\<`ChatItemDeletion`[]\>
518
+
519
+ ***
520
+
521
+ ### apiDeleteGroupLink()
522
+
523
+ > **apiDeleteGroupLink**(`groupId`): `Promise`\<`void`\>
524
+
525
+ Defined in: [src/api.ts:692](../src/api.ts#L692)
526
+
527
+ Delete group link.
528
+ Network usage: background.
529
+
530
+ #### Parameters
531
+
532
+ ##### groupId
533
+
534
+ `number`
535
+
536
+ #### Returns
537
+
538
+ `Promise`\<`void`\>
539
+
540
+ ***
541
+
542
+ ### apiDeleteMemberChatItem()
543
+
544
+ > **apiDeleteMemberChatItem**(`groupId`, `chatItemIds`): `Promise`\<`ChatItemDeletion`[]\>
545
+
546
+ Defined in: [src/api.ts:513](../src/api.ts#L513)
547
+
548
+ Moderate message. Requires Moderator role (and higher than message author's).
549
+ Network usage: background.
550
+
551
+ #### Parameters
552
+
553
+ ##### groupId
554
+
555
+ `number`
556
+
557
+ ##### chatItemIds
558
+
559
+ `number`[]
560
+
561
+ #### Returns
562
+
563
+ `Promise`\<`ChatItemDeletion`[]\>
564
+
565
+ ***
566
+
567
+ ### apiDeleteUser()
568
+
569
+ > **apiDeleteUser**(`userId`, `delSMPQueues`, `viewPwd?`): `Promise`\<`void`\>
570
+
571
+ Defined in: [src/api.ts:937](../src/api.ts#L937)
572
+
573
+ Delete user profile.
574
+ Network usage: background.
575
+
576
+ #### Parameters
577
+
578
+ ##### userId
579
+
580
+ `number`
581
+
582
+ ##### delSMPQueues
583
+
584
+ `boolean`
585
+
586
+ ##### viewPwd?
587
+
588
+ `string`
589
+
590
+ #### Returns
591
+
592
+ `Promise`\<`void`\>
593
+
594
+ ***
595
+
596
+ ### apiDeleteUserAddress()
597
+
598
+ > **apiDeleteUserAddress**(`userId`): `Promise`\<`void`\>
599
+
600
+ Defined in: [src/api.ts:370](../src/api.ts#L370)
601
+
602
+ Deletes a user address.
603
+ Network usage: background.
604
+
605
+ #### Parameters
606
+
607
+ ##### userId
608
+
609
+ `number`
610
+
611
+ #### Returns
612
+
613
+ `Promise`\<`void`\>
614
+
615
+ ***
616
+
617
+ ### apiGetActiveUser()
618
+
619
+ > **apiGetActiveUser**(): `Promise`\<`User` \| `undefined`\>
620
+
621
+ Defined in: [src/api.ts:887](../src/api.ts#L887)
622
+
623
+ Get active user profile
624
+ Network usage: no.
625
+
626
+ #### Returns
627
+
628
+ `Promise`\<`User` \| `undefined`\>
629
+
630
+ ***
631
+
632
+ ### apiGetChat()
633
+
634
+ > **apiGetChat**(`chatType`, `chatId`, `count`): `Promise`\<`any`\>
635
+
636
+ Defined in: [src/api.ts:877](../src/api.ts#L877)
637
+
638
+ Get chat items.
639
+ Network usage: no.
640
+
641
+ #### Parameters
642
+
643
+ ##### chatType
644
+
645
+ `ChatType`
646
+
647
+ ##### chatId
648
+
649
+ `number`
650
+
651
+ ##### count
652
+
653
+ `number`
654
+
655
+ #### Returns
656
+
657
+ `Promise`\<`any`\>
658
+
659
+ ***
660
+
661
+ ### apiGetChats()
662
+
663
+ > **apiGetChats**(`userId`, `pagination`, `query?`, `pendingConnections?`): `Promise`\<`AChat`[]\>
664
+
665
+ Defined in: [src/api.ts:814](../src/api.ts#L814)
666
+
667
+ Get chat previews (paginated).
668
+ Network usage: no.
669
+
670
+ Prefer this over apiListContacts / apiListGroups for any scan: those
671
+ methods load every record into memory in a single response and will fail
672
+ on large databases.
673
+
674
+ #### Parameters
675
+
676
+ ##### userId
677
+
678
+ `number`
679
+
680
+ ##### pagination
681
+
682
+ `Last`
683
+
684
+ ##### query?
685
+
686
+ `ChatListQuery` = `...`
687
+
688
+ ##### pendingConnections?
689
+
690
+ `boolean` = `false`
691
+
692
+ #### Returns
693
+
694
+ `Promise`\<`AChat`[]\>
695
+
696
+ ***
697
+
698
+ ### apiGetGroupLink()
699
+
700
+ > **apiGetGroupLink**(`groupId`): `Promise`\<`GroupLink`\>
701
+
702
+ Defined in: [src/api.ts:701](../src/api.ts#L701)
703
+
704
+ Get group link.
705
+ Network usage: no.
706
+
707
+ #### Parameters
708
+
709
+ ##### groupId
710
+
711
+ `number`
712
+
713
+ #### Returns
714
+
715
+ `Promise`\<`GroupLink`\>
716
+
717
+ ***
718
+
719
+ ### apiGetGroupLinkStr()
720
+
721
+ > **apiGetGroupLinkStr**(`groupId`): `Promise`\<`string`\>
722
+
723
+ Defined in: [src/api.ts:707](../src/api.ts#L707)
724
+
725
+ #### Parameters
726
+
727
+ ##### groupId
728
+
729
+ `number`
730
+
731
+ #### Returns
732
+
733
+ `Promise`\<`string`\>
734
+
735
+ ***
736
+
737
+ ### apiGetUserAddress()
738
+
739
+ > **apiGetUserAddress**(`userId`): `Promise`\<`UserContactLink` \| `undefined`\>
740
+
741
+ Defined in: [src/api.ts:380](../src/api.ts#L380)
742
+
743
+ Get bot address and settings.
744
+ Network usage: no.
745
+
746
+ #### Parameters
747
+
748
+ ##### userId
749
+
750
+ `number`
751
+
752
+ #### Returns
753
+
754
+ `Promise`\<`UserContactLink` \| `undefined`\>
755
+
756
+ ***
757
+
758
+ ### apiJoinGroup()
759
+
760
+ > **apiJoinGroup**(`groupId`): `Promise`\<`GroupInfo`\>
761
+
762
+ Defined in: [src/api.ts:580](../src/api.ts#L580)
763
+
764
+ Join group.
765
+ Network usage: interactive.
766
+
767
+ #### Parameters
768
+
769
+ ##### groupId
770
+
771
+ `number`
772
+
773
+ #### Returns
774
+
775
+ `Promise`\<`GroupInfo`\>
776
+
777
+ ***
778
+
779
+ ### apiLeaveGroup()
780
+
781
+ > **apiLeaveGroup**(`groupId`): `Promise`\<`GroupInfo`\>
782
+
783
+ Defined in: [src/api.ts:630](../src/api.ts#L630)
784
+
785
+ Leave group.
786
+ Network usage: background.
787
+
788
+ #### Parameters
789
+
790
+ ##### groupId
791
+
792
+ `number`
793
+
794
+ #### Returns
795
+
796
+ `Promise`\<`GroupInfo`\>
797
+
798
+ ***
799
+
800
+ ### apiListContacts()
801
+
802
+ > **apiListContacts**(`userId`): `Promise`\<`Contact`[]\>
803
+
804
+ Defined in: [src/api.ts:790](../src/api.ts#L790)
805
+
806
+ Get contacts.
807
+ Network usage: no.
808
+
809
+ #### Parameters
810
+
811
+ ##### userId
812
+
813
+ `number`
814
+
815
+ #### Returns
816
+
817
+ `Promise`\<`Contact`[]\>
818
+
819
+ ***
820
+
821
+ ### apiListGroups()
822
+
823
+ > **apiListGroups**(`userId`, `contactId?`, `search?`): `Promise`\<`GroupInfo`[]\>
824
+
825
+ Defined in: [src/api.ts:800](../src/api.ts#L800)
826
+
827
+ Get groups.
828
+ Network usage: no.
829
+
830
+ #### Parameters
831
+
832
+ ##### userId
833
+
834
+ `number`
835
+
836
+ ##### contactId?
837
+
838
+ `number`
839
+
840
+ ##### search?
841
+
842
+ `string`
843
+
844
+ #### Returns
845
+
846
+ `Promise`\<`GroupInfo`[]\>
847
+
848
+ ***
849
+
850
+ ### apiListMembers()
851
+
852
+ > **apiListMembers**(`groupId`): `Promise`\<`GroupMember`[]\>
853
+
854
+ Defined in: [src/api.ts:640](../src/api.ts#L640)
855
+
856
+ Get group members.
857
+ Network usage: no.
858
+
859
+ #### Parameters
860
+
861
+ ##### groupId
862
+
863
+ `number`
864
+
865
+ #### Returns
866
+
867
+ `Promise`\<`GroupMember`[]\>
868
+
869
+ ***
870
+
871
+ ### apiListUsers()
872
+
873
+ > **apiListUsers**(): `Promise`\<`UserInfo`[]\>
874
+
875
+ Defined in: [src/api.ts:917](../src/api.ts#L917)
876
+
877
+ Get all user profiles
878
+ Network usage: no.
879
+
880
+ #### Returns
881
+
882
+ `Promise`\<`UserInfo`[]\>
883
+
884
+ ***
885
+
886
+ ### apiNewGroup()
887
+
888
+ > **apiNewGroup**(`userId`, `groupProfile`): `Promise`\<`GroupInfo`\>
889
+
890
+ Defined in: [src/api.ts:650](../src/api.ts#L650)
891
+
892
+ Create group.
893
+ Network usage: no.
894
+
895
+ #### Parameters
896
+
897
+ ##### userId
898
+
899
+ `number`
900
+
901
+ ##### groupProfile
902
+
903
+ `GroupProfile`
904
+
905
+ #### Returns
906
+
907
+ `Promise`\<`GroupInfo`\>
908
+
909
+ ***
910
+
911
+ ### apiReceiveFile()
912
+
913
+ > **apiReceiveFile**(`fileId`): `Promise`\<`AChatItem`\>
914
+
915
+ Defined in: [src/api.ts:539](../src/api.ts#L539)
916
+
917
+ Receive file.
918
+ Network usage: no.
919
+
920
+ #### Parameters
921
+
922
+ ##### fileId
923
+
924
+ `number`
925
+
926
+ #### Returns
927
+
928
+ `Promise`\<`AChatItem`\>
929
+
930
+ ***
931
+
932
+ ### apiRejectContactRequest()
933
+
934
+ > **apiRejectContactRequest**(`contactReqId`): `Promise`\<`void`\>
935
+
936
+ Defined in: [src/api.ts:780](../src/api.ts#L780)
937
+
938
+ Reject contact request. The user who sent the request is **not notified**.
939
+ Network usage: no.
940
+
941
+ #### Parameters
942
+
943
+ ##### contactReqId
944
+
945
+ `number`
946
+
947
+ #### Returns
948
+
949
+ `Promise`\<`void`\>
950
+
951
+ ***
952
+
953
+ ### apiRemoveMembers()
954
+
955
+ > **apiRemoveMembers**(`groupId`, `memberIds`, `withMessages?`): `Promise`\<`GroupMember`[]\>
956
+
957
+ Defined in: [src/api.ts:620](../src/api.ts#L620)
958
+
959
+ Remove members. Requires Admin role.
960
+ Network usage: background.
961
+
962
+ #### Parameters
963
+
964
+ ##### groupId
965
+
966
+ `number`
967
+
968
+ ##### memberIds
969
+
970
+ `number`[]
971
+
972
+ ##### withMessages?
973
+
974
+ `boolean` = `false`
975
+
976
+ #### Returns
977
+
978
+ `Promise`\<`GroupMember`[]\>
979
+
980
+ ***
981
+
982
+ ### apiSendMemberContactInvitation()
983
+
984
+ > **apiSendMemberContactInvitation**(`contactId`, `message?`): `Promise`\<`Contact`\>
985
+
986
+ Defined in: [src/api.ts:984](../src/api.ts#L984)
987
+
988
+ Send a direct message invitation to a group member contact.
989
+ The contact must have been created with [apiCreateMemberContact](#apicreatemembercontact).
990
+ Network usage: interactive.
991
+
992
+ #### Parameters
993
+
994
+ ##### contactId
995
+
996
+ `number`
997
+
998
+ ##### message?
999
+
1000
+ `string` \| `MsgContent`
1001
+
1002
+ #### Returns
1003
+
1004
+ `Promise`\<`Contact`\>
1005
+
1006
+ ***
1007
+
1008
+ ### apiSendMessages()
1009
+
1010
+ > **apiSendMessages**(`chat`, `messages`, `liveMessage?`): `Promise`\<`AChatItem`[]\>
1011
+
1012
+ Defined in: [src/api.ts:442](../src/api.ts#L442)
1013
+
1014
+ Send messages.
1015
+ Network usage: background.
1016
+
1017
+ #### Parameters
1018
+
1019
+ ##### chat
1020
+
1021
+ `ChatInfo` \| `ChatRef` \| \[`ChatType`, `number`\]
1022
+
1023
+ ##### messages
1024
+
1025
+ `ComposedMessage`[]
1026
+
1027
+ ##### liveMessage?
1028
+
1029
+ `boolean` = `false`
1030
+
1031
+ #### Returns
1032
+
1033
+ `Promise`\<`AChatItem`[]\>
1034
+
1035
+ ***
1036
+
1037
+ ### apiSendTextMessage()
1038
+
1039
+ > **apiSendTextMessage**(`chat`, `text`, `inReplyTo?`): `Promise`\<`AChatItem`[]\>
1040
+
1041
+ Defined in: [src/api.ts:465](../src/api.ts#L465)
1042
+
1043
+ Send text message.
1044
+ Network usage: background.
1045
+
1046
+ #### Parameters
1047
+
1048
+ ##### chat
1049
+
1050
+ `ChatInfo` \| `ChatRef` \| \[`ChatType`, `number`\]
1051
+
1052
+ ##### text
1053
+
1054
+ `string`
1055
+
1056
+ ##### inReplyTo?
1057
+
1058
+ `number`
1059
+
1060
+ #### Returns
1061
+
1062
+ `Promise`\<`AChatItem`[]\>
1063
+
1064
+ ***
1065
+
1066
+ ### apiSendTextReply()
1067
+
1068
+ > **apiSendTextReply**(`chatItem`, `text`): `Promise`\<`AChatItem`[]\>
1069
+
1070
+ Defined in: [src/api.ts:473](../src/api.ts#L473)
1071
+
1072
+ Send text message in reply to received message.
1073
+ Network usage: background.
1074
+
1075
+ #### Parameters
1076
+
1077
+ ##### chatItem
1078
+
1079
+ `AChatItem`
1080
+
1081
+ ##### text
1082
+
1083
+ `string`
1084
+
1085
+ #### Returns
1086
+
1087
+ `Promise`\<`AChatItem`[]\>
1088
+
1089
+ ***
1090
+
1091
+ ### apiSetActiveUser()
1092
+
1093
+ > **apiSetActiveUser**(`userId`, `viewPwd?`): `Promise`\<`User`\>
1094
+
1095
+ Defined in: [src/api.ts:927](../src/api.ts#L927)
1096
+
1097
+ Set active user profile
1098
+ Network usage: no.
1099
+
1100
+ #### Parameters
1101
+
1102
+ ##### userId
1103
+
1104
+ `number`
1105
+
1106
+ ##### viewPwd?
1107
+
1108
+ `string`
1109
+
1110
+ #### Returns
1111
+
1112
+ `Promise`\<`User`\>
1113
+
1114
+ ***
1115
+
1116
+ ### apiSetAddressSettings()
1117
+
1118
+ > **apiSetAddressSettings**(`userId`, `__namedParameters`): `Promise`\<`void`\>
1119
+
1120
+ Defined in: [src/api.ts:414](../src/api.ts#L414)
1121
+
1122
+ Set bot address settings.
1123
+ Network usage: interactive.
1124
+
1125
+ #### Parameters
1126
+
1127
+ ##### userId
1128
+
1129
+ `number`
1130
+
1131
+ ##### \_\_namedParameters
1132
+
1133
+ [`BotAddressSettings`](api.Interface.BotAddressSettings.md)
1134
+
1135
+ #### Returns
1136
+
1137
+ `Promise`\<`void`\>
1138
+
1139
+ ***
1140
+
1141
+ ### apiSetAutoAcceptMemberContacts()
1142
+
1143
+ > **apiSetAutoAcceptMemberContacts**(`userId`, `onOff`): `Promise`\<`void`\>
1144
+
1145
+ Defined in: [src/api.ts:866](../src/api.ts#L866)
1146
+
1147
+ Set auto-accept member contacts.
1148
+ Network usage: no.
1149
+
1150
+ #### Parameters
1151
+
1152
+ ##### userId
1153
+
1154
+ `number`
1155
+
1156
+ ##### onOff
1157
+
1158
+ `boolean`
1159
+
1160
+ #### Returns
1161
+
1162
+ `Promise`\<`void`\>
1163
+
1164
+ ***
1165
+
1166
+ ### apiSetContactCustomData()
1167
+
1168
+ > **apiSetContactCustomData**(`contactId`, `customData?`): `Promise`\<`void`\>
1169
+
1170
+ Defined in: [src/api.ts:856](../src/api.ts#L856)
1171
+
1172
+ Set contact custom data.
1173
+ Network usage: no.
1174
+
1175
+ #### Parameters
1176
+
1177
+ ##### contactId
1178
+
1179
+ `number`
1180
+
1181
+ ##### customData?
1182
+
1183
+ `object`
1184
+
1185
+ #### Returns
1186
+
1187
+ `Promise`\<`void`\>
1188
+
1189
+ ***
1190
+
1191
+ ### apiSetContactPrefs()
1192
+
1193
+ > **apiSetContactPrefs**(`contactId`, `preferences`): `Promise`\<`void`\>
1194
+
1195
+ Defined in: [src/api.ts:963](../src/api.ts#L963)
1196
+
1197
+ Configure chat preference overrides for the contact.
1198
+ Network usage: background.
1199
+
1200
+ #### Parameters
1201
+
1202
+ ##### contactId
1203
+
1204
+ `number`
1205
+
1206
+ ##### preferences
1207
+
1208
+ `Preferences`
1209
+
1210
+ #### Returns
1211
+
1212
+ `Promise`\<`void`\>
1213
+
1214
+ ***
1215
+
1216
+ ### apiSetGroupCustomData()
1217
+
1218
+ > **apiSetGroupCustomData**(`groupId`, `customData?`): `Promise`\<`void`\>
1219
+
1220
+ Defined in: [src/api.ts:846](../src/api.ts#L846)
1221
+
1222
+ Set group custom data.
1223
+ Network usage: no.
1224
+
1225
+ #### Parameters
1226
+
1227
+ ##### groupId
1228
+
1229
+ `number`
1230
+
1231
+ ##### customData?
1232
+
1233
+ `object`
1234
+
1235
+ #### Returns
1236
+
1237
+ `Promise`\<`void`\>
1238
+
1239
+ ***
1240
+
1241
+ ### apiSetGroupLinkMemberRole()
1242
+
1243
+ > **apiSetGroupLinkMemberRole**(`groupId`, `memberRole`): `Promise`\<`void`\>
1244
+
1245
+ Defined in: [src/api.ts:683](../src/api.ts#L683)
1246
+
1247
+ Set member role for group link.
1248
+ Network usage: no.
1249
+
1250
+ #### Parameters
1251
+
1252
+ ##### groupId
1253
+
1254
+ `number`
1255
+
1256
+ ##### memberRole
1257
+
1258
+ `GroupMemberRole`
1259
+
1260
+ #### Returns
1261
+
1262
+ `Promise`\<`void`\>
1263
+
1264
+ ***
1265
+
1266
+ ### apiSetMembersRole()
1267
+
1268
+ > **apiSetMembersRole**(`groupId`, `groupMemberIds`, `memberRole`): `Promise`\<`void`\>
1269
+
1270
+ Defined in: [src/api.ts:600](../src/api.ts#L600)
1271
+
1272
+ Set members role. Requires Admin role.
1273
+ Network usage: background.
1274
+
1275
+ #### Parameters
1276
+
1277
+ ##### groupId
1278
+
1279
+ `number`
1280
+
1281
+ ##### groupMemberIds
1282
+
1283
+ `number`[]
1284
+
1285
+ ##### memberRole
1286
+
1287
+ `GroupMemberRole`
1288
+
1289
+ #### Returns
1290
+
1291
+ `Promise`\<`void`\>
1292
+
1293
+ ***
1294
+
1295
+ ### apiSetProfileAddress()
1296
+
1297
+ > **apiSetProfileAddress**(`userId`, `enable`): `Promise`\<`UserProfileUpdateSummary`\>
1298
+
1299
+ Defined in: [src/api.ts:398](../src/api.ts#L398)
1300
+
1301
+ Add address to bot profile.
1302
+ Network usage: interactive.
1303
+
1304
+ #### Parameters
1305
+
1306
+ ##### userId
1307
+
1308
+ `number`
1309
+
1310
+ ##### enable
1311
+
1312
+ `boolean`
1313
+
1314
+ #### Returns
1315
+
1316
+ `Promise`\<`UserProfileUpdateSummary`\>
1317
+
1318
+ ***
1319
+
1320
+ ### apiSetUserDomain()
1321
+
1322
+ > **apiSetUserDomain**(`userId`, `simplexDomain?`): `Promise`\<`User`\>
1323
+
1324
+ Defined in: [src/api.ts:427](../src/api.ts#L427)
1325
+
1326
+ #### Parameters
1327
+
1328
+ ##### userId
1329
+
1330
+ `number`
1331
+
1332
+ ##### simplexDomain?
1333
+
1334
+ `string`
1335
+
1336
+ #### Returns
1337
+
1338
+ `Promise`\<`User`\>
1339
+
1340
+ ***
1341
+
1342
+ ### apiUpdateChatItem()
1343
+
1344
+ > **apiUpdateChatItem**(`chatType`, `chatId`, `chatItemId`, `msgContent`, `liveMessage`): `Promise`\<`ChatItem`\>
1345
+
1346
+ Defined in: [src/api.ts:481](../src/api.ts#L481)
1347
+
1348
+ Update message.
1349
+ Network usage: background.
1350
+
1351
+ #### Parameters
1352
+
1353
+ ##### chatType
1354
+
1355
+ `ChatType`
1356
+
1357
+ ##### chatId
1358
+
1359
+ `number`
1360
+
1361
+ ##### chatItemId
1362
+
1363
+ `number`
1364
+
1365
+ ##### msgContent
1366
+
1367
+ `MsgContent`
1368
+
1369
+ ##### liveMessage
1370
+
1371
+ `false`
1372
+
1373
+ #### Returns
1374
+
1375
+ `Promise`\<`ChatItem`\>
1376
+
1377
+ ***
1378
+
1379
+ ### apiUpdateGroupProfile()
1380
+
1381
+ > **apiUpdateGroupProfile**(`groupId`, `groupProfile`): `Promise`\<`GroupInfo`\>
1382
+
1383
+ Defined in: [src/api.ts:660](../src/api.ts#L660)
1384
+
1385
+ Update group profile.
1386
+ Network usage: background.
1387
+
1388
+ #### Parameters
1389
+
1390
+ ##### groupId
1391
+
1392
+ `number`
1393
+
1394
+ ##### groupProfile
1395
+
1396
+ `GroupProfile`
1397
+
1398
+ #### Returns
1399
+
1400
+ `Promise`\<`GroupInfo`\>
1401
+
1402
+ ***
1403
+
1404
+ ### apiUpdateProfile()
1405
+
1406
+ > **apiUpdateProfile**(`userId`, `profile`): `Promise`\<`UserProfileUpdateSummary` \| `undefined`\>
1407
+
1408
+ Defined in: [src/api.ts:947](../src/api.ts#L947)
1409
+
1410
+ Update user profile.
1411
+ Network usage: background.
1412
+
1413
+ #### Parameters
1414
+
1415
+ ##### userId
1416
+
1417
+ `number`
1418
+
1419
+ ##### profile
1420
+
1421
+ `Profile`
1422
+
1423
+ #### Returns
1424
+
1425
+ `Promise`\<`UserProfileUpdateSummary` \| `undefined`\>
1426
+
1427
+ ***
1428
+
1429
+ ### close()
1430
+
1431
+ > **close**(): `Promise`\<`void`\>
1432
+
1433
+ Defined in: [src/api.ts:157](../src/api.ts#L157)
1434
+
1435
+ Stop chat controller and close chat database.
1436
+ The database is not closed if stopping fails.
1437
+ Usually doesn't need to be called in chat bots.
1438
+
1439
+ #### Returns
1440
+
1441
+ `Promise`\<`void`\>
1442
+
1443
+ ***
1444
+
1445
+ ### off()
1446
+
1447
+ > **off**\<`K`\>(`event`, `subscriber?`): `void`
1448
+
1449
+ Defined in: [src/api.ts:301](../src/api.ts#L301)
1450
+
1451
+ Unsubscribe all or a specific handler from a specific event.
1452
+
1453
+ #### Type Parameters
1454
+
1455
+ ##### K
1456
+
1457
+ `K` *extends* `Tag`
1458
+
1459
+ #### Parameters
1460
+
1461
+ ##### event
1462
+
1463
+ `K`
1464
+
1465
+ The event type to unsubscribe from.
1466
+
1467
+ ##### subscriber?
1468
+
1469
+ [`EventSubscriberFunc`](api.TypeAlias.EventSubscriberFunc.md)\<`K`\> \| `undefined`
1470
+
1471
+ An optional subscriber function for the event.
1472
+
1473
+ #### Returns
1474
+
1475
+ `void`
1476
+
1477
+ ***
1478
+
1479
+ ### offAny()
1480
+
1481
+ > **offAny**(`receiver?`): `void`
1482
+
1483
+ Defined in: [src/api.ts:317](../src/api.ts#L317)
1484
+
1485
+ Unsubscribe all or a specific handler from any events.
1486
+
1487
+ #### Parameters
1488
+
1489
+ ##### receiver?
1490
+
1491
+ [`EventSubscriberFunc`](api.TypeAlias.EventSubscriberFunc.md)\<`Tag`\> \| `undefined`
1492
+
1493
+ An optional subscriber function for the event.
1494
+
1495
+ #### Returns
1496
+
1497
+ `void`
1498
+
1499
+ ***
1500
+
1501
+ ### on()
1502
+
1503
+ #### Call Signature
1504
+
1505
+ > **on**\<`K`\>(`subscribers`): `void`
1506
+
1507
+ Defined in: [src/api.ts:211](../src/api.ts#L211)
1508
+
1509
+ Subscribe multiple event handlers at once.
1510
+
1511
+ ##### Type Parameters
1512
+
1513
+ ###### K
1514
+
1515
+ `K` *extends* `Tag`
1516
+
1517
+ ##### Parameters
1518
+
1519
+ ###### subscribers
1520
+
1521
+ [`EventSubscribers`](api.TypeAlias.EventSubscribers.md)
1522
+
1523
+ An object mapping event types (CEvt.Tag) to their subscriber functions.
1524
+
1525
+ ##### Returns
1526
+
1527
+ `void`
1528
+
1529
+ ##### Throws
1530
+
1531
+ If the same function is subscribed to event.
1532
+
1533
+ #### Call Signature
1534
+
1535
+ > **on**\<`K`\>(`event`, `subscriber`): `void`
1536
+
1537
+ Defined in: [src/api.ts:219](../src/api.ts#L219)
1538
+
1539
+ Subscribe a handler to a specific event.
1540
+
1541
+ ##### Type Parameters
1542
+
1543
+ ###### K
1544
+
1545
+ `K` *extends* `Tag`
1546
+
1547
+ ##### Parameters
1548
+
1549
+ ###### event
1550
+
1551
+ `K`
1552
+
1553
+ The event type to subscribe to.
1554
+
1555
+ ###### subscriber
1556
+
1557
+ [`EventSubscriberFunc`](api.TypeAlias.EventSubscriberFunc.md)\<`K`\>
1558
+
1559
+ The subscriber function for the event.
1560
+
1561
+ ##### Returns
1562
+
1563
+ `void`
1564
+
1565
+ ##### Throws
1566
+
1567
+ If the same function is subscribed to event.
1568
+
1569
+ ***
1570
+
1571
+ ### onAny()
1572
+
1573
+ > **onAny**(`receiver`): `void`
1574
+
1575
+ Defined in: [src/api.ts:242](../src/api.ts#L242)
1576
+
1577
+ Subscribe a handler to any event.
1578
+
1579
+ #### Parameters
1580
+
1581
+ ##### receiver
1582
+
1583
+ [`EventSubscriberFunc`](api.TypeAlias.EventSubscriberFunc.md)\<`Tag`\>
1584
+
1585
+ The receiver function for any event.
1586
+
1587
+ #### Returns
1588
+
1589
+ `void`
1590
+
1591
+ #### Throws
1592
+
1593
+ If the same function is subscribed to event.
1594
+
1595
+ ***
1596
+
1597
+ ### once()
1598
+
1599
+ > **once**\<`K`\>(`event`, `subscriber`): `void`
1600
+
1601
+ Defined in: [src/api.ts:253](../src/api.ts#L253)
1602
+
1603
+ Subscribe a handler to a specific event to be delivered one time.
1604
+
1605
+ #### Type Parameters
1606
+
1607
+ ##### K
1608
+
1609
+ `K` *extends* `Tag`
1610
+
1611
+ #### Parameters
1612
+
1613
+ ##### event
1614
+
1615
+ `K`
1616
+
1617
+ The event type to subscribe to.
1618
+
1619
+ ##### subscriber
1620
+
1621
+ [`EventSubscriberFunc`](api.TypeAlias.EventSubscriberFunc.md)\<`K`\>
1622
+
1623
+ The subscriber function for the event.
1624
+
1625
+ #### Returns
1626
+
1627
+ `void`
1628
+
1629
+ #### Throws
1630
+
1631
+ If the same function is subscribed to event.
1632
+
1633
+ ***
1634
+
1635
+ ### recvChatEvent()
1636
+
1637
+ > **recvChatEvent**(`wait?`): `Promise`\<`ChatEvent` \| `undefined`\>
1638
+
1639
+ Defined in: [src/api.ts:352](../src/api.ts#L352)
1640
+
1641
+ #### Parameters
1642
+
1643
+ ##### wait?
1644
+
1645
+ `number` = `500_000`
1646
+
1647
+ #### Returns
1648
+
1649
+ `Promise`\<`ChatEvent` \| `undefined`\>
1650
+
1651
+ ***
1652
+
1653
+ ### sendChatCmd()
1654
+
1655
+ > **sendChatCmd**(`cmd`): `Promise`\<`ChatResponse`\>
1656
+
1657
+ Defined in: [src/api.ts:348](../src/api.ts#L348)
1658
+
1659
+ #### Parameters
1660
+
1661
+ ##### cmd
1662
+
1663
+ `string`
1664
+
1665
+ #### Returns
1666
+
1667
+ `Promise`\<`ChatResponse`\>
1668
+
1669
+ ***
1670
+
1671
+ ### startChat()
1672
+
1673
+ > **startChat**(): `Promise`\<`void`\>
1674
+
1675
+ Defined in: [src/api.ts:123](../src/api.ts#L123)
1676
+
1677
+ Start chat controller. Must be called with the existing user profile.
1678
+
1679
+ #### Returns
1680
+
1681
+ `Promise`\<`void`\>
1682
+
1683
+ ***
1684
+
1685
+ ### stopChat()
1686
+
1687
+ > **stopChat**(): `Promise`\<`void`\>
1688
+
1689
+ Defined in: [src/api.ts:146](../src/api.ts#L146)
1690
+
1691
+ Stop chat controller.
1692
+ `close` calls it before closing the database.
1693
+ Usually doesn't need to be called in chat bots.
1694
+
1695
+ #### Returns
1696
+
1697
+ `Promise`\<`void`\>
1698
+
1699
+ ***
1700
+
1701
+ ### wait()
1702
+
1703
+ #### Call Signature
1704
+
1705
+ > **wait**\<`K`\>(`event`): `Promise`\<`ChatEvent` & `object`\>
1706
+
1707
+ Defined in: [src/api.ts:261](../src/api.ts#L261)
1708
+
1709
+ Waits for specific event, with an optional predicate.
1710
+ Returns `undefined` on timeout if specified.
1711
+
1712
+ ##### Type Parameters
1713
+
1714
+ ###### K
1715
+
1716
+ `K` *extends* `Tag`
1717
+
1718
+ ##### Parameters
1719
+
1720
+ ###### event
1721
+
1722
+ `K`
1723
+
1724
+ ##### Returns
1725
+
1726
+ `Promise`\<`ChatEvent` & `object`\>
1727
+
1728
+ #### Call Signature
1729
+
1730
+ > **wait**\<`K`\>(`event`, `predicate`): `Promise`\<`ChatEvent` & `object`\>
1731
+
1732
+ Defined in: [src/api.ts:262](../src/api.ts#L262)
1733
+
1734
+ Waits for specific event, with an optional predicate.
1735
+ Returns `undefined` on timeout if specified.
1736
+
1737
+ ##### Type Parameters
1738
+
1739
+ ###### K
1740
+
1741
+ `K` *extends* `Tag`
1742
+
1743
+ ##### Parameters
1744
+
1745
+ ###### event
1746
+
1747
+ `K`
1748
+
1749
+ ###### predicate
1750
+
1751
+ ((`event`) => `boolean`) \| `undefined`
1752
+
1753
+ ##### Returns
1754
+
1755
+ `Promise`\<`ChatEvent` & `object`\>
1756
+
1757
+ #### Call Signature
1758
+
1759
+ > **wait**\<`K`\>(`event`, `timeout`): `Promise`\<ChatEvent & \{ type: K; \} \| `undefined`\>
1760
+
1761
+ Defined in: [src/api.ts:263](../src/api.ts#L263)
1762
+
1763
+ Waits for specific event, with an optional predicate.
1764
+ Returns `undefined` on timeout if specified.
1765
+
1766
+ ##### Type Parameters
1767
+
1768
+ ###### K
1769
+
1770
+ `K` *extends* `Tag`
1771
+
1772
+ ##### Parameters
1773
+
1774
+ ###### event
1775
+
1776
+ `K`
1777
+
1778
+ ###### timeout
1779
+
1780
+ `number`
1781
+
1782
+ ##### Returns
1783
+
1784
+ `Promise`\<ChatEvent & \{ type: K; \} \| `undefined`\>
1785
+
1786
+ #### Call Signature
1787
+
1788
+ > **wait**\<`K`\>(`event`, `predicate`, `timeout`): `Promise`\<ChatEvent & \{ type: K; \} \| `undefined`\>
1789
+
1790
+ Defined in: [src/api.ts:264](../src/api.ts#L264)
1791
+
1792
+ Waits for specific event, with an optional predicate.
1793
+ Returns `undefined` on timeout if specified.
1794
+
1795
+ ##### Type Parameters
1796
+
1797
+ ###### K
1798
+
1799
+ `K` *extends* `Tag`
1800
+
1801
+ ##### Parameters
1802
+
1803
+ ###### event
1804
+
1805
+ `K`
1806
+
1807
+ ###### predicate
1808
+
1809
+ ((`event`) => `boolean`) \| `undefined`
1810
+
1811
+ ###### timeout
1812
+
1813
+ `number`
1814
+
1815
+ ##### Returns
1816
+
1817
+ `Promise`\<ChatEvent & \{ type: K; \} \| `undefined`\>
1818
+
1819
+ ***
1820
+
1821
+ ### init()
1822
+
1823
+ > `static` **init**(`db`, `confirm?`, `queueSize?`): `Promise`\<`ChatApi`\>
1824
+
1825
+ Defined in: [src/api.ts:109](../src/api.ts#L109)
1826
+
1827
+ Initializes the ChatApi, loading libsimplex for `db.type` (downloaded on first use).
1828
+
1829
+ #### Parameters
1830
+
1831
+ ##### db
1832
+
1833
+ [`DbConfig`](api.TypeAlias.DbConfig.md)
1834
+
1835
+ Database configuration (sqlite or postgres).
1836
+
1837
+ ##### confirm?
1838
+
1839
+ [`MigrationConfirmation`](core.Enumeration.MigrationConfirmation.md) = `core.MigrationConfirmation.YesUp`
1840
+
1841
+ Migration confirmation mode.
1842
+
1843
+ ##### queueSize?
1844
+
1845
+ `number`
1846
+
1847
+ Size of internal queues, the core default is used when omitted.
1848
+
1849
+ #### Returns
1850
+
1851
+ `Promise`\<`ChatApi`\>