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.
- package/lib/adapter/input/index.d.ts +1 -1
- package/lib/adapter/input/index.js +1 -1
- package/lib/adapter/onebot/11/event.js +90 -84
- package/lib/adapter/onebot/11/index.d.ts +89 -127
- package/lib/adapter/onebot/11/index.js +192 -254
- package/lib/cli/index.js +2 -2
- package/lib/core/init/config.js +1 -1
- package/lib/core/karin/karin.d.ts +21 -30
- package/lib/core/karin/karin.js +7 -9
- package/lib/core/listener/listener.js +11 -11
- package/lib/core/plugin/base.d.ts +7 -21
- package/lib/core/plugin/base.js +2 -6
- package/lib/core/plugin/loader.d.ts +5 -15
- package/lib/core/plugin/loader.js +5 -15
- package/lib/core/server/server.js +4 -4
- package/lib/event/handler/base.d.ts +1 -3
- package/lib/event/handler/base.js +1 -3
- package/lib/event/handler/message.js +9 -3
- package/lib/event/handler/notice.js +38 -32
- package/lib/event/handler/request.js +6 -6
- package/lib/index.d.ts +6 -0
- package/lib/index.js +6 -0
- package/lib/modules.d.ts +2 -2
- package/lib/modules.js +3 -2
- package/lib/types/adapter/accept.d.ts +24 -0
- package/lib/types/adapter/accept.js +1 -0
- package/lib/types/adapter/api.d.ts +88 -264
- package/lib/types/adapter/base.d.ts +3 -3
- package/lib/types/config/config.d.ts +4 -12
- package/lib/types/element/element.d.ts +119 -349
- package/lib/types/element/qqbot.d.ts +4 -12
- package/lib/types/event/contact.d.ts +6 -12
- package/lib/types/event/event.d.ts +59 -163
- package/lib/types/event/message.d.ts +11 -31
- package/lib/types/event/message.js +10 -12
- package/lib/types/event/notice.d.ts +118 -325
- package/lib/types/event/notice.js +8 -10
- package/lib/types/event/request.d.ts +29 -66
- package/lib/types/event/request.js +8 -10
- package/lib/types/event/sender.d.ts +7 -21
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/onebot11/api.d.ts +49 -49
- package/lib/types/onebot11/event.d.ts +131 -347
- package/lib/types/onebot11/params.d.ts +184 -456
- package/lib/types/onebot11/response.d.ts +159 -381
- package/lib/types/onebot11/segment.d.ts +25 -75
- package/lib/types/onebot11/sender.d.ts +13 -39
- package/lib/types/plugin/app.d.ts +7 -11
- package/lib/types/plugin/plugin.d.ts +55 -165
- package/lib/types/render/render.d.ts +16 -48
- package/lib/utils/common/common.js +4 -2
- package/lib/utils/config/config.js +1 -1
- package/lib/utils/core/logger.js +3 -3
- package/lib/utils/core/segment.d.ts +28 -59
- package/lib/utils/core/segment.js +26 -30
- package/lib/utils/tools/restart.d.ts +3 -3
- package/lib/utils/tools/restart.js +5 -5
- 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
|
|
56
|
+
* @param groupId - 群号
|
|
59
57
|
* @param size - 头像大小,默认`0`
|
|
60
58
|
* @param history - 历史头像记录,默认`0`,若要获取历史群头像则填写1,2,3...
|
|
61
59
|
* @returns - 群头像的url地址
|
|
62
60
|
*/
|
|
63
|
-
getGroupAvatarUrl(
|
|
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
|
|
92
|
+
* @param messageId - 消息ID
|
|
95
93
|
*/
|
|
96
|
-
RecallMessage(_contact: Contact,
|
|
94
|
+
RecallMessage(_contact: Contact, messageId: string): Promise<boolean>;
|
|
97
95
|
/**
|
|
98
96
|
* 获取消息
|
|
99
97
|
* @param contact - 联系人信息
|
|
100
|
-
* @param
|
|
98
|
+
* @param messageId - 消息ID
|
|
101
99
|
*/
|
|
102
|
-
GetMessage(contact: Contact,
|
|
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,
|
|
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
|
|
142
|
-
* @param
|
|
139
|
+
* @param targetId - 用户ID
|
|
140
|
+
* @param voteCount - 赞的次数,默认为`10`
|
|
143
141
|
*/
|
|
144
|
-
VoteUser(
|
|
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(
|
|
150
|
+
KickMember(groupId: string, targetId: string, rejectAddRequest?: boolean, kickReason?: string): Promise<boolean>;
|
|
149
151
|
/**
|
|
150
152
|
* 禁言用户
|
|
151
|
-
* @param
|
|
152
|
-
* @param
|
|
153
|
+
* @param groupId - 群号
|
|
154
|
+
* @param targetId - 用户ID
|
|
153
155
|
* @param duration - 禁言时长,单位秒,0 表示取消禁言
|
|
154
156
|
*/
|
|
155
|
-
BanMember(
|
|
157
|
+
BanMember(groupId: string, targetId: string, duration: number): Promise<boolean>;
|
|
156
158
|
/**
|
|
157
159
|
* 群组全员禁言
|
|
158
|
-
* @param
|
|
159
|
-
* @param
|
|
160
|
+
* @param groupId - 群号
|
|
161
|
+
* @param isBan - 是否全员禁言
|
|
160
162
|
*/
|
|
161
|
-
SetGroupWholeBan(
|
|
163
|
+
SetGroupWholeBan(groupId: string, isBan?: boolean): Promise<boolean>;
|
|
162
164
|
/**
|
|
163
165
|
* 设置群管理员
|
|
164
|
-
* @param
|
|
165
|
-
* @param
|
|
166
|
-
* @param
|
|
166
|
+
* @param groupId - 群号
|
|
167
|
+
* @param targetId - 目标用户ID
|
|
168
|
+
* @param isAdmin - 是否设置为管理员
|
|
167
169
|
*/
|
|
168
|
-
SetGroupAdmin(
|
|
170
|
+
SetGroupAdmin(groupId: string, targetId: string, isAdmin: boolean): Promise<boolean>;
|
|
169
171
|
/**
|
|
170
172
|
* 修改群名片
|
|
171
|
-
* @param
|
|
172
|
-
* @param
|
|
173
|
+
* @param groupId - 群号
|
|
174
|
+
* @param targetId - 目标用户ID
|
|
173
175
|
* @param card - 新名片
|
|
174
176
|
*/
|
|
175
|
-
ModifyMemberCard(
|
|
177
|
+
ModifyMemberCard(groupId: string, targetId: string, card: string): Promise<boolean>;
|
|
176
178
|
/**
|
|
177
179
|
* 设置群名
|
|
178
|
-
* @param
|
|
179
|
-
* @param
|
|
180
|
+
* @param groupId - 群号
|
|
181
|
+
* @param groupName - 新群名
|
|
180
182
|
*/
|
|
181
|
-
ModifyGroupName(
|
|
183
|
+
ModifyGroupName(groupId: string, groupName: string): Promise<boolean>;
|
|
182
184
|
/**
|
|
183
185
|
* 退出群组
|
|
184
|
-
* @param
|
|
185
|
-
* @param
|
|
186
|
+
* @param groupId - 群号
|
|
187
|
+
* @param isDismiss - 是否解散,如果登录号是群主,则仅在此项为 true 时能够解散
|
|
186
188
|
*/
|
|
187
|
-
LeaveGroup(
|
|
189
|
+
LeaveGroup(groupId: string, isDismiss?: boolean): Promise<false | undefined>;
|
|
188
190
|
/**
|
|
189
191
|
* 设置群专属头衔
|
|
190
|
-
* @param
|
|
191
|
-
* @param
|
|
192
|
+
* @param groupId - 群号
|
|
193
|
+
* @param targetId - 目标用户ID
|
|
192
194
|
* @param special_title - 专属头衔
|
|
193
195
|
*/
|
|
194
|
-
SetGroupUniqueTitle(
|
|
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
|
|
207
|
+
* @param targetId - 目标用户ID
|
|
206
208
|
*/
|
|
207
|
-
GetStrangerProfileCard(
|
|
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
|
|
361
|
-
* @param
|
|
322
|
+
* @param _groupId - 群号
|
|
323
|
+
* @param noCache - 是否不使用缓存
|
|
362
324
|
*/
|
|
363
|
-
GetGroupInfo(
|
|
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
|
|
380
|
-
* @param
|
|
341
|
+
* @param groupId - 群号
|
|
342
|
+
* @param targetId - 目标用户ID
|
|
381
343
|
* @param refresh - 是否刷新缓存,默认为 false
|
|
382
344
|
*/
|
|
383
|
-
GetGroupMemberInfo(
|
|
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
|
|
365
|
+
* @param groupId - 群号
|
|
404
366
|
* @param refresh - 是否刷新缓存,默认为 false
|
|
405
367
|
*/
|
|
406
|
-
GetGroupMemberList(
|
|
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(
|
|
389
|
+
GetGroupHonor(groupId: string, refresh?: boolean): Promise<GroupHonorInfo[]>;
|
|
428
390
|
/**
|
|
429
391
|
* 对消息进行表情回应
|
|
430
392
|
* @param contact - 联系人信息
|
|
431
|
-
* @param
|
|
432
|
-
* @param
|
|
393
|
+
* @param messageId - 消息ID
|
|
394
|
+
* @param faceId - 表情ID
|
|
433
395
|
*/
|
|
434
|
-
ReactMessageWithEmoji(contact: Contact,
|
|
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(
|
|
406
|
+
DownloadForwardMessage(resId: string): Promise<any>;
|
|
445
407
|
/**
|
|
446
408
|
* 精华消息
|
|
447
409
|
*/
|
|
448
|
-
GetEssenceMessageList(
|
|
410
|
+
GetEssenceMessageList(groupId: string, page: number, pageSize: number): Promise<EssenceMessageBody[]>;
|
|
449
411
|
/**
|
|
450
412
|
* 上传群文件
|
|
451
|
-
* @param
|
|
413
|
+
* @param groupId - 群号
|
|
452
414
|
* @param file - 本地文件绝对路径
|
|
453
415
|
* @param name - 文件名称 必须提供
|
|
454
416
|
* @param folder - 父目录ID 不提供则上传到根目录
|
|
455
417
|
*/
|
|
456
|
-
UploadGroupFile(
|
|
418
|
+
UploadGroupFile(groupId: string, file: string, name: string, folder?: string): Promise<boolean>;
|
|
457
419
|
/**
|
|
458
420
|
* 上传私聊文件
|
|
459
|
-
* @param
|
|
421
|
+
* @param userId - 用户ID
|
|
460
422
|
* @param file - 本地文件绝对路径
|
|
461
423
|
* @param name - 文件名称 必须提供
|
|
462
424
|
*/
|
|
463
|
-
UploadPrivateFile(
|
|
425
|
+
UploadPrivateFile(userId: string, file: string, name: string): Promise<boolean>;
|
|
464
426
|
/**
|
|
465
427
|
* 设置精华消息
|
|
466
|
-
* @param
|
|
467
|
-
* @param
|
|
428
|
+
* @param _groupId - 群号
|
|
429
|
+
* @param messageId - 消息ID
|
|
468
430
|
*/
|
|
469
|
-
SetEssenceMessage(
|
|
431
|
+
SetEssenceMessage(_groupId: string, messageId: string): Promise<boolean>;
|
|
470
432
|
/**
|
|
471
433
|
* 移除精华消息
|
|
472
|
-
* @param
|
|
473
|
-
* @param
|
|
474
|
-
*/
|
|
475
|
-
DeleteEssenceMessage(
|
|
476
|
-
PokeMember(
|
|
477
|
-
SetFriendApplyResult(
|
|
478
|
-
SetGroupApplyResult(
|
|
479
|
-
SetInvitedJoinGroupResult(
|
|
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>;
|