node-karin 0.12.13 → 0.12.15

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 (59) hide show
  1. package/lib/adapter/input/index.d.ts +1 -1
  2. package/lib/adapter/input/index.js +1 -1
  3. package/lib/adapter/onebot/11/event.js +90 -84
  4. package/lib/adapter/onebot/11/index.d.ts +89 -127
  5. package/lib/adapter/onebot/11/index.js +192 -254
  6. package/lib/cli/index.js +2 -2
  7. package/lib/core/init/config.js +1 -1
  8. package/lib/core/karin/karin.d.ts +21 -30
  9. package/lib/core/karin/karin.js +7 -9
  10. package/lib/core/listener/listener.js +11 -11
  11. package/lib/core/plugin/base.d.ts +7 -21
  12. package/lib/core/plugin/base.js +2 -6
  13. package/lib/core/plugin/loader.d.ts +5 -15
  14. package/lib/core/plugin/loader.js +5 -15
  15. package/lib/core/server/server.js +4 -4
  16. package/lib/event/handler/base.d.ts +1 -3
  17. package/lib/event/handler/base.js +1 -3
  18. package/lib/event/handler/message.js +9 -3
  19. package/lib/event/handler/notice.js +38 -32
  20. package/lib/event/handler/request.js +6 -6
  21. package/lib/index.d.ts +6 -0
  22. package/lib/index.js +6 -0
  23. package/lib/modules.d.ts +2 -2
  24. package/lib/modules.js +3 -2
  25. package/lib/types/adapter/accept.d.ts +24 -0
  26. package/lib/types/adapter/accept.js +1 -0
  27. package/lib/types/adapter/api.d.ts +88 -264
  28. package/lib/types/adapter/base.d.ts +3 -3
  29. package/lib/types/config/config.d.ts +4 -12
  30. package/lib/types/element/element.d.ts +119 -349
  31. package/lib/types/element/qqbot.d.ts +4 -12
  32. package/lib/types/event/contact.d.ts +6 -12
  33. package/lib/types/event/event.d.ts +59 -163
  34. package/lib/types/event/message.d.ts +11 -31
  35. package/lib/types/event/message.js +10 -12
  36. package/lib/types/event/notice.d.ts +118 -325
  37. package/lib/types/event/notice.js +8 -10
  38. package/lib/types/event/request.d.ts +29 -66
  39. package/lib/types/event/request.js +8 -10
  40. package/lib/types/event/sender.d.ts +7 -21
  41. package/lib/types/index.d.ts +1 -0
  42. package/lib/types/index.js +1 -0
  43. package/lib/types/onebot11/api.d.ts +49 -49
  44. package/lib/types/onebot11/event.d.ts +131 -347
  45. package/lib/types/onebot11/params.d.ts +184 -456
  46. package/lib/types/onebot11/response.d.ts +159 -381
  47. package/lib/types/onebot11/segment.d.ts +25 -75
  48. package/lib/types/onebot11/sender.d.ts +13 -39
  49. package/lib/types/plugin/app.d.ts +7 -11
  50. package/lib/types/plugin/plugin.d.ts +55 -165
  51. package/lib/types/render/render.d.ts +16 -48
  52. package/lib/utils/common/common.js +4 -2
  53. package/lib/utils/config/config.js +1 -1
  54. package/lib/utils/core/logger.js +3 -3
  55. package/lib/utils/core/segment.d.ts +28 -59
  56. package/lib/utils/core/segment.js +26 -30
  57. package/lib/utils/tools/restart.d.ts +3 -3
  58. package/lib/utils/tools/restart.js +5 -5
  59. package/package.json +1 -2
@@ -8,9 +8,7 @@ import { Scene, Contact, KarinElement, OB11EventAll, GroupInfo, NodeElement, Ess
8
8
  */
9
9
  export declare class AdapterOneBot11 implements KarinAdapter {
10
10
  #private;
11
- /**
12
- * - 重连次数 仅正向ws使用
13
- */
11
+ /** 重连次数 仅正向ws使用 */
14
12
  index: number;
15
13
  socket: WebSocket;
16
14
  account: KarinAdapter['account'];
@@ -55,12 +53,12 @@ export declare class AdapterOneBot11 implements KarinAdapter {
55
53
  getAvatarUrl(uid?: string, size?: number): string;
56
54
  /**
57
55
  * 获取群头像
58
- * @param group_id - 群号
56
+ * @param groupId - 群号
59
57
  * @param size - 头像大小,默认`0`
60
58
  * @param history - 历史头像记录,默认`0`,若要获取历史群头像则填写1,2,3...
61
59
  * @returns - 群头像的url地址
62
60
  */
63
- getGroupAvatarUrl(group_id: string, size?: number, history?: number): string;
61
+ getGroupAvatarUrl(groupId: string, size?: number, history?: number): string;
64
62
  /**
65
63
  * 发送消息
66
64
  *
@@ -91,15 +89,15 @@ export declare class AdapterOneBot11 implements KarinAdapter {
91
89
  /**
92
90
  * 撤回消息
93
91
  * @param _contact - ob11无需提供contact参数
94
- * @param message_id - 消息ID
92
+ * @param messageId - 消息ID
95
93
  */
96
- RecallMessage(_contact: Contact, message_id: string): Promise<boolean>;
94
+ RecallMessage(_contact: Contact, messageId: string): Promise<boolean>;
97
95
  /**
98
96
  * 获取消息
99
97
  * @param contact - 联系人信息
100
- * @param message_id - 消息ID
98
+ * @param messageId - 消息ID
101
99
  */
102
- GetMessage(contact: Contact, message_id: string): Promise<{
100
+ GetMessage(contact: Contact, messageId: string): Promise<{
103
101
  time: number;
104
102
  message_id: string;
105
103
  message_seq: number;
@@ -119,7 +117,7 @@ export declare class AdapterOneBot11 implements KarinAdapter {
119
117
  * 获取msg_id获取历史消息
120
118
  * @description 此api各平台实现不同
121
119
  */
122
- GetHistoryMessage(contact: Contact, start_message_id: string, count?: number): Promise<{
120
+ GetHistoryMessage(contact: Contact, startMessageId: string, count?: number): Promise<{
123
121
  time: number;
124
122
  message_id: string;
125
123
  message_seq: number;
@@ -138,60 +136,64 @@ export declare class AdapterOneBot11 implements KarinAdapter {
138
136
  }[]>;
139
137
  /**
140
138
  * 发送好友赞
141
- * @param target_uid_or_uin - 用户ID
142
- * @param vote_count - 赞的次数,默认为`10`
139
+ * @param targetId - 用户ID
140
+ * @param voteCount - 赞的次数,默认为`10`
143
141
  */
144
- VoteUser(target_uid_or_uin: string, vote_count?: number): Promise<boolean>;
142
+ VoteUser(targetId: string, voteCount?: number): Promise<boolean>;
145
143
  /**
146
144
  * 群组踢人
145
+ * @param groupId - 群号
146
+ * @param targetId - 用户ID
147
+ * @param rejectAddRequest - 是否拒绝此人的加群请求
148
+ * @param kickReason - 踢人理由
147
149
  */
148
- KickMember(group_id: string, target_uid_or_uin: string, reject_add_request?: boolean, kick_reason?: string): Promise<boolean>;
150
+ KickMember(groupId: string, targetId: string, rejectAddRequest?: boolean, kickReason?: string): Promise<boolean>;
149
151
  /**
150
152
  * 禁言用户
151
- * @param group_id - 群号
152
- * @param target_uid_or_uin - 用户ID
153
+ * @param groupId - 群号
154
+ * @param targetId - 用户ID
153
155
  * @param duration - 禁言时长,单位秒,0 表示取消禁言
154
156
  */
155
- BanMember(group_id: string, target_uid_or_uin: string, duration: number): Promise<boolean>;
157
+ BanMember(groupId: string, targetId: string, duration: number): Promise<boolean>;
156
158
  /**
157
159
  * 群组全员禁言
158
- * @param group_id - 群号
159
- * @param is_ban - 是否全员禁言
160
+ * @param groupId - 群号
161
+ * @param isBan - 是否全员禁言
160
162
  */
161
- SetGroupWholeBan(group_id: string, is_ban?: boolean): Promise<boolean>;
163
+ SetGroupWholeBan(groupId: string, isBan?: boolean): Promise<boolean>;
162
164
  /**
163
165
  * 设置群管理员
164
- * @param group_id - 群号
165
- * @param target_uid_or_uin - 目标用户ID
166
- * @param is_admin - 是否设置为管理员
166
+ * @param groupId - 群号
167
+ * @param targetId - 目标用户ID
168
+ * @param isAdmin - 是否设置为管理员
167
169
  */
168
- SetGroupAdmin(group_id: string, target_uid_or_uin: string, is_admin: boolean): Promise<boolean>;
170
+ SetGroupAdmin(groupId: string, targetId: string, isAdmin: boolean): Promise<boolean>;
169
171
  /**
170
172
  * 修改群名片
171
- * @param group_id - 群号
172
- * @param target_uid_or_uin - 目标用户ID
173
+ * @param groupId - 群号
174
+ * @param targetId - 目标用户ID
173
175
  * @param card - 新名片
174
176
  */
175
- ModifyMemberCard(group_id: string, target_uid_or_uin: string, card: string): Promise<boolean>;
177
+ ModifyMemberCard(groupId: string, targetId: string, card: string): Promise<boolean>;
176
178
  /**
177
179
  * 设置群名
178
- * @param group_id - 群号
179
- * @param group_name - 新群名
180
+ * @param groupId - 群号
181
+ * @param groupName - 新群名
180
182
  */
181
- ModifyGroupName(group_id: string, group_name: string): Promise<boolean>;
183
+ ModifyGroupName(groupId: string, groupName: string): Promise<boolean>;
182
184
  /**
183
185
  * 退出群组
184
- * @param group_id - 群号
185
- * @param is_dismiss - 是否解散,如果登录号是群主,则仅在此项为 true 时能够解散
186
+ * @param groupId - 群号
187
+ * @param isDismiss - 是否解散,如果登录号是群主,则仅在此项为 true 时能够解散
186
188
  */
187
- LeaveGroup(group_id: string, is_dismiss?: boolean): Promise<false | undefined>;
189
+ LeaveGroup(groupId: string, isDismiss?: boolean): Promise<false | undefined>;
188
190
  /**
189
191
  * 设置群专属头衔
190
- * @param group_id - 群号
191
- * @param target_uid_or_uin - 目标用户ID
192
+ * @param groupId - 群号
193
+ * @param targetId - 目标用户ID
192
194
  * @param special_title - 专属头衔
193
195
  */
194
- SetGroupUniqueTitle(group_id: string, target_uid_or_uin: string, unique_title: string): Promise<false | undefined>;
196
+ SetGroupUniqueTitle(groupId: string, targetId: string, uniqueTitle: string): Promise<false | undefined>;
195
197
  /**
196
198
  * 获取登录号信息
197
199
  */
@@ -202,48 +204,28 @@ export declare class AdapterOneBot11 implements KarinAdapter {
202
204
  }>;
203
205
  /**
204
206
  * 获取陌生人信息 不支持批量获取 只支持一个
205
- * @param target_uid_or_uin - 目标用户ID
207
+ * @param targetId - 目标用户ID
206
208
  */
207
- GetStrangerProfileCard(target_uid_or_uin: Array<string>): Promise<{
208
- /**
209
- * - 用户UID
210
- */
209
+ GetStrangerProfileCard(targetId: Array<string>): Promise<{
210
+ /** 用户UID */
211
211
  uid: string;
212
- /**
213
- * - 用户UIN
214
- */
212
+ /** 用户UIN */
215
213
  uin: string;
216
- /**
217
- * - qid
218
- */
214
+ /** qid */
219
215
  qid: string;
220
- /**
221
- * - 名称
222
- */
216
+ /** 名称 */
223
217
  nick: string;
224
- /**
225
- * - 备注
226
- */
218
+ /** 备注 */
227
219
  remark: string;
228
- /**
229
- * - 用户等级
230
- */
220
+ /** 用户等级 */
231
221
  level: number;
232
- /**
233
- * - 生日
234
- */
222
+ /** 生日 */
235
223
  birthday: string;
236
- /**
237
- * - 登录天数
238
- */
224
+ /** 登录天数 */
239
225
  login_day: number;
240
- /**
241
- * - 点赞数
242
- */
226
+ /** 点赞数 */
243
227
  vote_cnt: number;
244
- /**
245
- * - 学校是否已核实
246
- */
228
+ /** 学校是否已核实 */
247
229
  is_school_verified: undefined;
248
230
  /**
249
231
  * - 年龄
@@ -282,45 +264,25 @@ export declare class AdapterOneBot11 implements KarinAdapter {
282
264
  * 获取好友列表
283
265
  */
284
266
  GetFriendList(): Promise<{
285
- /**
286
- * - 用户UID
287
- */
267
+ /** 用户UID */
288
268
  uid: string;
289
- /**
290
- * - 用户UIN
291
- */
269
+ /** 用户UIN */
292
270
  uin: string;
293
- /**
294
- * - qid
295
- */
271
+ /** qid */
296
272
  qid: string;
297
- /**
298
- * - 名称
299
- */
273
+ /** 名称 */
300
274
  nick: string;
301
- /**
302
- * - 备注
303
- */
275
+ /** 备注 */
304
276
  remark: string;
305
- /**
306
- * - 用户等级
307
- */
277
+ /** 用户等级 */
308
278
  level: number;
309
- /**
310
- * - 生日
311
- */
279
+ /** 生日 */
312
280
  birthday: string;
313
- /**
314
- * - 登录天数
315
- */
281
+ /** 登录天数 */
316
282
  login_day: number;
317
- /**
318
- * - 点赞数
319
- */
283
+ /** 点赞数 */
320
284
  vote_cnt: number;
321
- /**
322
- * - 学校是否已核实
323
- */
285
+ /** 学校是否已核实 */
324
286
  is_school_verified: undefined;
325
287
  /**
326
288
  * - 年龄
@@ -357,10 +319,10 @@ export declare class AdapterOneBot11 implements KarinAdapter {
357
319
  }[]>;
358
320
  /**
359
321
  * 获取群信息
360
- * @param group_id - 群号
361
- * @param no_cache - 是否不使用缓存
322
+ * @param _groupId - 群号
323
+ * @param noCache - 是否不使用缓存
362
324
  */
363
- GetGroupInfo(group_id: string, no_cache?: boolean): Promise<GroupInfo>;
325
+ GetGroupInfo(_groupId: string, noCache?: boolean): Promise<GroupInfo>;
364
326
  /**
365
327
  * 获取群列表
366
328
  */
@@ -376,11 +338,11 @@ export declare class AdapterOneBot11 implements KarinAdapter {
376
338
  }[]>;
377
339
  /**
378
340
  * 获取群成员信息
379
- * @param group_id - 群号
380
- * @param target_uid_or_uin - 目标用户ID
341
+ * @param groupId - 群号
342
+ * @param targetId - 目标用户ID
381
343
  * @param refresh - 是否刷新缓存,默认为 false
382
344
  */
383
- GetGroupMemberInfo(group_id: string, target_uid_or_uin: string, refresh?: boolean): Promise<{
345
+ GetGroupMemberInfo(groupId: string, targetId: string, refresh?: boolean): Promise<{
384
346
  uid: string;
385
347
  uin: string;
386
348
  nick: string;
@@ -400,10 +362,10 @@ export declare class AdapterOneBot11 implements KarinAdapter {
400
362
  }>;
401
363
  /**
402
364
  * 获取群成员列表
403
- * @param group_id - 群号
365
+ * @param groupId - 群号
404
366
  * @param refresh - 是否刷新缓存,默认为 false
405
367
  */
406
- GetGroupMemberList(group_id: string, refresh?: boolean): Promise<{
368
+ GetGroupMemberList(groupId: string, refresh?: boolean): Promise<{
407
369
  uid: string;
408
370
  uin: string;
409
371
  nick: string;
@@ -424,14 +386,14 @@ export declare class AdapterOneBot11 implements KarinAdapter {
424
386
  /**
425
387
  * 获取群荣誉信息
426
388
  */
427
- GetGroupHonor(group_id: string, refresh?: boolean): Promise<GroupHonorInfo[]>;
389
+ GetGroupHonor(groupId: string, refresh?: boolean): Promise<GroupHonorInfo[]>;
428
390
  /**
429
391
  * 对消息进行表情回应
430
392
  * @param contact - 联系人信息
431
- * @param message_id - 消息ID
432
- * @param face_id - 表情ID
393
+ * @param messageId - 消息ID
394
+ * @param faceId - 表情ID
433
395
  */
434
- ReactMessageWithEmoji(contact: Contact, message_id: string, face_id: number, is_set?: boolean): Promise<boolean>;
396
+ ReactMessageWithEmoji(contact: Contact, messageId: string, faceId: number, isSet?: boolean): Promise<boolean>;
435
397
  /**
436
398
  * 获取版本信息
437
399
  */
@@ -441,42 +403,42 @@ export declare class AdapterOneBot11 implements KarinAdapter {
441
403
  version: string;
442
404
  protocol: string;
443
405
  }>;
444
- DownloadForwardMessage(res_id: string): Promise<any>;
406
+ DownloadForwardMessage(resId: string): Promise<any>;
445
407
  /**
446
408
  * 精华消息
447
409
  */
448
- GetEssenceMessageList(group_id: string, page: number, page_size: number): Promise<EssenceMessageBody[]>;
410
+ GetEssenceMessageList(groupId: string, page: number, pageSize: number): Promise<EssenceMessageBody[]>;
449
411
  /**
450
412
  * 上传群文件
451
- * @param group_id - 群号
413
+ * @param groupId - 群号
452
414
  * @param file - 本地文件绝对路径
453
415
  * @param name - 文件名称 必须提供
454
416
  * @param folder - 父目录ID 不提供则上传到根目录
455
417
  */
456
- UploadGroupFile(group_id: string, file: string, name: string, folder?: string): Promise<boolean>;
418
+ UploadGroupFile(groupId: string, file: string, name: string, folder?: string): Promise<boolean>;
457
419
  /**
458
420
  * 上传私聊文件
459
- * @param user_id - 用户ID
421
+ * @param userId - 用户ID
460
422
  * @param file - 本地文件绝对路径
461
423
  * @param name - 文件名称 必须提供
462
424
  */
463
- UploadPrivateFile(user_id: string, file: string, name: string): Promise<boolean>;
425
+ UploadPrivateFile(userId: string, file: string, name: string): Promise<boolean>;
464
426
  /**
465
427
  * 设置精华消息
466
- * @param _group_id - 群号
467
- * @param message_id - 消息ID
428
+ * @param _groupId - 群号
429
+ * @param messageId - 消息ID
468
430
  */
469
- SetEssenceMessage(_group_id: string, message_id: string): Promise<boolean>;
431
+ SetEssenceMessage(_groupId: string, messageId: string): Promise<boolean>;
470
432
  /**
471
433
  * 移除精华消息
472
- * @param _group_id - 群号
473
- * @param message_id - 消息ID
474
- */
475
- DeleteEssenceMessage(_group_id: string, message_id: string): Promise<boolean>;
476
- PokeMember(group_id: string, target_uid_or_uin: string): Promise<void>;
477
- SetFriendApplyResult(request_id: string, is_approve: boolean, remark?: string): Promise<boolean>;
478
- SetGroupApplyResult(request_id: string, is_approve: boolean, deny_reason?: string): Promise<boolean>;
479
- SetInvitedJoinGroupResult(request_id: string, is_approve: boolean, deny_reason?: string): Promise<boolean>;
434
+ * @param _groupId - 群号
435
+ * @param messageId - 消息ID
436
+ */
437
+ DeleteEssenceMessage(_groupId: string, messageId: string): Promise<boolean>;
438
+ PokeMember(groupId: string, targetId: string): Promise<void>;
439
+ SetFriendApplyResult(requestId: string, isApprove: boolean, remark?: string): Promise<boolean>;
440
+ SetGroupApplyResult(requestId: string, isApprove: boolean, denyReason?: string): Promise<boolean>;
441
+ SetInvitedJoinGroupResult(requestId: string, isApprove: boolean, denyReason?: string): Promise<boolean>;
480
442
  DownloadFile(): Promise<any>;
481
443
  CreateFolder(): Promise<any>;
482
444
  RenameFolder(): Promise<any>;