node-karin 1.10.12 → 1.10.14

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/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # 更新日志
2
2
 
3
+ ## [1.10.14](https://github.com/KarinJS/Karin/compare/core-v1.10.13...core-v1.10.14) (2025-06-30)
4
+
5
+
6
+ ### 🐛 Bug Fixes
7
+
8
+ * onebot 声明周期事件错误 ([7bf0152](https://github.com/KarinJS/Karin/commit/7bf0152fc1d807ea46a1f0998da78403c0883acf))
9
+
10
+ ## [1.10.13](https://github.com/KarinJS/Karin/compare/core-v1.10.12...core-v1.10.13) (2025-06-30)
11
+
12
+
13
+ ### 🐛 Bug Fixes
14
+
15
+ * close [#429](https://github.com/KarinJS/Karin/issues/429) ([bf28049](https://github.com/KarinJS/Karin/commit/bf280492827eb9c1f4208b9179f40998a9094012))
16
+
17
+
18
+ ### 📦️ Build System
19
+
20
+ * fix types error ([05feb59](https://github.com/KarinJS/Karin/commit/05feb59aad90ebff0f31e4f0440f7a9dddf241fc))
21
+
3
22
  ## [1.10.12](https://github.com/KarinJS/Karin/compare/core-v1.10.11...core-v1.10.12) (2025-06-28)
4
23
 
5
24
 
package/dist/index.d.ts CHANGED
@@ -1191,9 +1191,8 @@ interface AdapterType<T = any> {
1191
1191
  * 撤回消息
1192
1192
  * @param contact 目标信息
1193
1193
  * @param messageId 消息ID
1194
- * @returns 此接口的返回值不值得信任
1195
1194
  */
1196
- recallMsg(contact: Contact, messageId: string): Promise<boolean>;
1195
+ recallMsg(contact: Contact, messageId: string): Promise<void>;
1197
1196
  /**
1198
1197
  * 获取头像url
1199
1198
  * @param userId 用户ID
@@ -1266,76 +1265,67 @@ interface AdapterType<T = any> {
1266
1265
  * @param messageId 群消息ID
1267
1266
  * @param create true为添加精华消息,false为删除精华消息 默认为true
1268
1267
  */
1269
- setGgroupHighlights(groupId: string, messageId: string, create: boolean): Promise<boolean>;
1268
+ setGroupHighlights(groupId: string, messageId: string, create: boolean): Promise<void>;
1270
1269
  /**
1271
1270
  * 发送好友赞
1272
1271
  * @param targetId 目标ID
1273
1272
  * @param count 赞的次数,默认为10
1274
- * @returns 此接口的返回值不值得信任
1275
1273
  */
1276
- sendLike(targetId: string, count: number): Promise<boolean>;
1274
+ sendLike(targetId: string, count: number): Promise<void>;
1277
1275
  /**
1278
1276
  * 群踢人
1279
1277
  * @param groupId 群ID
1280
1278
  * @param targetId 被踢出目标的ID 任选其一
1281
1279
  * @param rejectAddRequest 是否拒绝再次申请,默认为false
1282
1280
  * @param kickReason 踢出原因,可选
1283
- * @returns 此接口的返回值不值得信任
1284
1281
  */
1285
- groupKickMember(groupId: string, targetId: string, rejectAddRequest?: boolean, kickReason?: string): Promise<boolean>;
1282
+ groupKickMember(groupId: string, targetId: string, rejectAddRequest?: boolean, kickReason?: string): Promise<void>;
1286
1283
  /**
1287
1284
  * 禁言群成员
1288
1285
  * @param groupId 群ID
1289
1286
  * @param targetId 被禁言目标的ID 任选其一
1290
1287
  * @param duration 禁言时长 单位:秒
1291
- * @returns 此接口的返回值不值得信任
1292
1288
  */
1293
- setGroupMute(groupId: string, targetId: string, duration: number): Promise<boolean>;
1289
+ setGroupMute(groupId: string, targetId: string, duration: number): Promise<void>;
1294
1290
  /**
1295
1291
  * 群全员禁言
1296
1292
  * @param groupId 群ID
1297
1293
  * @param isBan 是否开启全员禁言
1298
- * @returns 此接口的返回值不值得信任
1299
1294
  */
1300
- setGroupAllMute(groupId: string, isBan: boolean): Promise<boolean>;
1295
+ setGroupAllMute(groupId: string, isBan: boolean): Promise<void>;
1301
1296
  /**
1302
1297
  * 设置群管理员
1303
1298
  * @param groupId 群ID
1304
1299
  * @param targetId 目标用户的ID
1305
1300
  * @param isAdmin 是否设置为管理员
1306
- * @returns 此接口的返回值不值得信任
1307
1301
  */
1308
- setGroupAdmin(groupId: string, targetId: string, isAdmin: boolean): Promise<boolean>;
1302
+ setGroupAdmin(groupId: string, targetId: string, isAdmin: boolean): Promise<void>;
1309
1303
  /**
1310
1304
  * 设置群名片
1311
1305
  * @param groupId 群ID
1312
1306
  * @param targetId 目标用户的ID
1313
1307
  * @param card 新的群名片
1314
- * @returns 此接口的返回值不值得信任
1315
1308
  */
1316
- setGroupMemberCard(groupId: string, targetId: string, card: string): Promise<boolean>;
1309
+ setGroupMemberCard(groupId: string, targetId: string, card: string): Promise<void>;
1317
1310
  /**
1318
1311
  * 设置群名
1319
1312
  * @param groupId 群ID
1320
1313
  * @param groupName 新的群名
1321
- * @returns 此接口的返回值不值得信任
1322
1314
  */
1323
- setGroupName(groupId: string, groupName: string): Promise<boolean>;
1315
+ setGroupName(groupId: string, groupName: string): Promise<void>;
1324
1316
  /**
1325
1317
  * 退出群组
1326
1318
  * @param groupId 群ID
1327
1319
  * @param isDismiss 如果Bot是群主,是否解散群
1328
- * @returns 此接口的返回值不值得信任
1329
1320
  */
1330
- setGroupQuit(groupId: string, isDismiss: boolean): Promise<boolean>;
1321
+ setGroupQuit(groupId: string, isDismiss: boolean): Promise<void>;
1331
1322
  /**
1332
1323
  * 设置群专属头衔 仅群主可用
1333
1324
  * @param groupId 群ID
1334
1325
  * @param targetId 目标用户的ID
1335
1326
  * @param title 新的专属头衔
1336
- * @returns 此接口的返回值不值得信任
1337
1327
  */
1338
- setGroupMemberTitle(groupId: string, targetId: string, title: string): Promise<boolean>;
1328
+ setGroupMemberTitle(groupId: string, targetId: string, title: string): Promise<void>;
1339
1329
  /**
1340
1330
  * 获取陌生人信息
1341
1331
  * @param targetId 用户ID 任选其一
@@ -1390,39 +1380,35 @@ interface AdapterType<T = any> {
1390
1380
  * @param remark 好友备注 同意时有效
1391
1381
  * @returns 设置结果
1392
1382
  */
1393
- setFriendApplyResult(requestId: string, isApprove: boolean, remark?: string): Promise<boolean>;
1383
+ setFriendApplyResult(requestId: string, isApprove: boolean, remark?: string): Promise<void>;
1394
1384
  /**
1395
1385
  * 设置申请加入群请求结果
1396
1386
  * @param requestId 请求事件ID
1397
1387
  * @param isApprove 是否同意
1398
1388
  * @param denyReason 拒绝理由 拒绝时有效
1399
- * @returns 此接口的返回值不值得信任
1400
1389
  */
1401
- setGroupApplyResult(requestId: string, isApprove: boolean, denyReason?: string): Promise<boolean>;
1390
+ setGroupApplyResult(requestId: string, isApprove: boolean, denyReason?: string): Promise<void>;
1402
1391
  /**
1403
1392
  * 设置邀请加入群请求结果
1404
1393
  * @param requestId 请求事件ID
1405
1394
  * @param isApprove 是否同意
1406
- * @returns 此接口的返回值不值得信任
1407
1395
  */
1408
- setInvitedJoinGroupResult(requestId: string, isApprove: boolean): Promise<boolean>;
1396
+ setInvitedJoinGroupResult(requestId: string, isApprove: boolean): Promise<void>;
1409
1397
  /**
1410
1398
  * 设置消息表情回应
1411
1399
  * @param contact 目标信息
1412
1400
  * @param messageId 消息ID
1413
1401
  * @param faceId 表情ID
1414
- * @returns 此接口的返回值不值得信任
1415
1402
  */
1416
- setMsgReaction(contact: Contact, messageId: string, faceId: number, isSet: boolean): Promise<boolean>;
1403
+ setMsgReaction(contact: Contact, messageId: string, faceId: number, isSet: boolean): Promise<void>;
1417
1404
  /**
1418
1405
  * 上传群文件、私聊文件
1419
1406
  * @param contact 目标信息
1420
1407
  * @param file 本地文件绝对路径
1421
1408
  * @param name 文件名称 必须提供
1422
1409
  * @param folder 父目录ID 不提供则上传到根目录 仅在群聊时有效
1423
- * @returns 此接口的返回值不值得信任
1424
1410
  */
1425
- uploadFile(contact: Contact, file: string, name: string, folder?: string): Promise<boolean>;
1411
+ uploadFile(contact: Contact, file: string, name: string, folder?: string): Promise<void>;
1426
1412
  /**
1427
1413
  * 让协议端下载文件到协议端本地
1428
1414
  * @param options 下载文件的选项
@@ -1492,7 +1478,6 @@ interface AdapterType<T = any> {
1492
1478
  * 设置群备注
1493
1479
  * @param groupId 群号
1494
1480
  * @param remark 新的备注
1495
- * @returns 此接口的返回值不值得信任
1496
1481
  */
1497
1482
  setGroupRemark(groupId: string, remark: string): Promise<boolean>;
1498
1483
  /**
@@ -1516,7 +1501,6 @@ interface AdapterType<T = any> {
1516
1501
  * 戳一戳用户 支持群聊和私聊
1517
1502
  * @param contact 目标信息
1518
1503
  * @param count 戳一戳次数 默认为1
1519
- * @returns 此接口的返回值不值得信任
1520
1504
  */
1521
1505
  pokeUser(contact: Contact, count?: number): Promise<boolean>;
1522
1506
  /**
@@ -1545,7 +1529,7 @@ interface AdapterType<T = any> {
1545
1529
  * @param file base64:// file:// http(s)://
1546
1530
  * @returns 是否设置成功
1547
1531
  */
1548
- setAvatar(file: string): Promise<boolean>;
1532
+ setAvatar(file: string): Promise<void>;
1549
1533
  /**
1550
1534
  * 获取群 Ai 语音可用声色列表
1551
1535
  * @returns 声色列表
@@ -3148,9 +3132,8 @@ declare abstract class AdapterBase<T = any> implements AdapterType<T> {
3148
3132
  * 撤回消息
3149
3133
  * @param _contact 目标信息
3150
3134
  * @param _messageId 消息ID
3151
- * @returns 此接口的返回值不值得信任
3152
3135
  */
3153
- recallMsg(_contact: Contact, _messageId: string): Promise<boolean>;
3136
+ recallMsg(_contact: Contact, _messageId: string): Promise<void>;
3154
3137
  /**
3155
3138
  * 获取头像url
3156
3139
  * @param _userId 用户ID
@@ -3216,76 +3199,67 @@ declare abstract class AdapterBase<T = any> implements AdapterType<T> {
3216
3199
  * @param _messageId 群消息ID
3217
3200
  * @param _create true为添加精华消息,false为删除精华消息 默认为true
3218
3201
  */
3219
- setGgroupHighlights(_groupId: string, _messageId: string, _create: boolean): Promise<boolean>;
3202
+ setGroupHighlights(_groupId: string, _messageId: string, _create: boolean): Promise<void>;
3220
3203
  /**
3221
3204
  * 发送好友赞
3222
3205
  * @param _targetId 目标ID
3223
3206
  * @param _count 赞的次数
3224
- * @returns 此接口的返回值不值得信任
3225
3207
  */
3226
- sendLike(_targetId: string, _count: number): Promise<boolean>;
3208
+ sendLike(_targetId: string, _count: number): Promise<void>;
3227
3209
  /**
3228
3210
  * 群踢人
3229
3211
  * @param _groupId 群ID
3230
3212
  * @param _targetId 被踢出目标的ID 任选其一
3231
3213
  * @param _rejectAddRequest 是否拒绝再次申请,默认为false
3232
3214
  * @param _kickReason 踢出原因,可选
3233
- * @returns 此接口的返回值不值得信任
3234
3215
  */
3235
- groupKickMember(_groupId: string, _targetId: string, _rejectAddRequest?: boolean, _kickReason?: string): Promise<boolean>;
3216
+ groupKickMember(_groupId: string, _targetId: string, _rejectAddRequest?: boolean, _kickReason?: string): Promise<void>;
3236
3217
  /**
3237
3218
  * 禁言群成员
3238
3219
  * @param _groupId 群ID
3239
3220
  * @param _targetId 被禁言目标的ID 任选其一
3240
3221
  * @param _duration 禁言时长 单位:秒
3241
- * @returns 此接口的返回值不值得信任
3242
3222
  */
3243
- setGroupMute(_groupId: string, _targetId: string, _duration: number): Promise<boolean>;
3223
+ setGroupMute(_groupId: string, _targetId: string, _duration: number): Promise<void>;
3244
3224
  /**
3245
3225
  * 群全员禁言
3246
3226
  * @param _groupId 群ID
3247
3227
  * @param _isBan 是否开启全员禁言
3248
- * @returns 此接口的返回值不值得信任
3249
3228
  */
3250
- setGroupAllMute(_groupId: string, _isBan: boolean): Promise<boolean>;
3229
+ setGroupAllMute(_groupId: string, _isBan: boolean): Promise<void>;
3251
3230
  /**
3252
3231
  * 设置群管理员
3253
3232
  * @param _groupId 群ID
3254
3233
  * @param _targetId 目标用户的ID
3255
3234
  * @param _isAdmin 是否设置为管理员
3256
- * @returns 此接口的返回值不值得信任
3257
3235
  */
3258
- setGroupAdmin(_groupId: string, _targetId: string, _isAdmin: boolean): Promise<boolean>;
3236
+ setGroupAdmin(_groupId: string, _targetId: string, _isAdmin: boolean): Promise<void>;
3259
3237
  /**
3260
3238
  * 设置群名片
3261
3239
  * @param _groupId 群ID
3262
3240
  * @param _targetId 目标用户的ID
3263
3241
  * @param _card 新的群名片
3264
- * @returns 此接口的返回值不值得信任
3265
3242
  */
3266
- setGroupMemberCard(_groupId: string, _targetId: string, _card: string): Promise<boolean>;
3243
+ setGroupMemberCard(_groupId: string, _targetId: string, _card: string): Promise<void>;
3267
3244
  /**
3268
3245
  * 设置群名
3269
3246
  * @param _groupId 群ID
3270
3247
  * @param _groupName 新的群名
3271
- * @returns 此接口的返回值不值得信任
3272
3248
  */
3273
- setGroupName(_groupId: string, _groupName: string): Promise<boolean>;
3249
+ setGroupName(_groupId: string, _groupName: string): Promise<void>;
3274
3250
  /**
3275
3251
  * 退出群组
3276
3252
  * @param _groupId 群ID
3277
3253
  * @param _isDismiss 如果Bot是群主,是否解散群
3278
- * @returns 此接口的返回值不值得信任
3279
3254
  */
3280
- setGroupQuit(_groupId: string, _isDismiss: boolean): Promise<boolean>;
3255
+ setGroupQuit(_groupId: string, _isDismiss: boolean): Promise<void>;
3281
3256
  /**
3282
3257
  * 设置群专属头衔 仅群主可用
3283
3258
  * @param _groupId 群ID
3284
3259
  * @param _targetId 目标用户的ID
3285
3260
  * @param _title 新的专属头衔
3286
- * @returns 此接口的返回值不值得信任
3287
3261
  */
3288
- setGroupMemberTitle(_groupId: string, _targetId: string, _title: string): Promise<boolean>;
3262
+ setGroupMemberTitle(_groupId: string, _targetId: string, _title: string): Promise<void>;
3289
3263
  /**
3290
3264
  * 获取陌生人信息 此接口数据无法保证完全正确并且无法保证数据的完整性
3291
3265
  * @param _targetId 用户ID 任选其一
@@ -3339,41 +3313,36 @@ declare abstract class AdapterBase<T = any> implements AdapterType<T> {
3339
3313
  * @param _requestId 请求事件ID
3340
3314
  * @param _isApprove 是否同意
3341
3315
  * @param _remark 好友备注 同意时有效
3342
- * @returns 设置结果
3343
3316
  */
3344
- setFriendApplyResult(_requestId: string, _isApprove: boolean, _remark?: string): Promise<boolean>;
3317
+ setFriendApplyResult(_requestId: string, _isApprove: boolean, _remark?: string): Promise<void>;
3345
3318
  /**
3346
3319
  * 设置申请加入群请求结果
3347
3320
  * @param _requestId 请求事件ID
3348
3321
  * @param _isApprove 是否同意
3349
3322
  * @param _denyReason 拒绝理由 拒绝时有效
3350
- * @returns 此接口的返回值不值得信任
3351
3323
  */
3352
- setGroupApplyResult(_requestId: string, _isApprove: boolean, _denyReason?: string): Promise<boolean>;
3324
+ setGroupApplyResult(_requestId: string, _isApprove: boolean, _denyReason?: string): Promise<void>;
3353
3325
  /**
3354
3326
  * 设置邀请加入群请求结果
3355
3327
  * @param _requestId 请求事件ID
3356
3328
  * @param _isApprove 是否同意
3357
- * @returns 此接口的返回值不值得信任
3358
3329
  */
3359
- setInvitedJoinGroupResult(_requestId: string, _isApprove: boolean): Promise<boolean>;
3330
+ setInvitedJoinGroupResult(_requestId: string, _isApprove: boolean): Promise<void>;
3360
3331
  /**
3361
3332
  * 设置消息表情回应
3362
3333
  * @param _contact 目标信息
3363
3334
  * @param _messageId 消息ID
3364
3335
  * @param _faceId 表情ID
3365
- * @returns 此接口的返回值不值得信任
3366
3336
  */
3367
- setMsgReaction(_contact: Contact, _messageId: string, _faceId: number, _isSet: boolean): Promise<boolean>;
3337
+ setMsgReaction(_contact: Contact, _messageId: string, _faceId: number, _isSet: boolean): Promise<void>;
3368
3338
  /**
3369
3339
  * 上传群文件、私聊文件
3370
3340
  * @param _contact 目标信息
3371
3341
  * @param _file 本地文件绝对路径
3372
3342
  * @param _name 文件名称 必须提供
3373
3343
  * @param _folder 父目录ID 不提供则上传到根目录 仅在群聊时有效
3374
- * @returns 此接口的返回值不值得信任
3375
3344
  */
3376
- uploadFile(_contact: Contact, _file: string, _name: string, _folder?: string): Promise<boolean>;
3345
+ uploadFile(_contact: Contact, _file: string, _name: string, _folder?: string): Promise<void>;
3377
3346
  /**
3378
3347
  * 让协议端下载文件到协议端本地
3379
3348
  * @param _options 下载文件的选项
@@ -3443,7 +3412,6 @@ declare abstract class AdapterBase<T = any> implements AdapterType<T> {
3443
3412
  * 设置群备注
3444
3413
  * @param _groupId 群号
3445
3414
  * @param _remark 新的备注
3446
- * @returns 此接口的返回值不值得信任
3447
3415
  */
3448
3416
  setGroupRemark(_groupId: string, _remark: string): Promise<boolean>;
3449
3417
  /**
@@ -3467,7 +3435,6 @@ declare abstract class AdapterBase<T = any> implements AdapterType<T> {
3467
3435
  * 戳一戳用户 支持群聊和私聊
3468
3436
  * @param _contact 目标信息
3469
3437
  * @param _count 戳一戳次数 默认为1
3470
- * @returns 此接口的返回值不值得信任
3471
3438
  */
3472
3439
  pokeUser(_contact: Contact, _count?: number): Promise<boolean>;
3473
3440
  /**
@@ -3494,9 +3461,8 @@ declare abstract class AdapterBase<T = any> implements AdapterType<T> {
3494
3461
  /**
3495
3462
  * 设置头像
3496
3463
  * @param file base64:// file:// http(s)://
3497
- * @returns 是否设置成功
3498
3464
  */
3499
- setAvatar(_file: string): Promise<boolean>;
3465
+ setAvatar(_file: string): Promise<void>;
3500
3466
  /**
3501
3467
  * 获取 rkey
3502
3468
  * @returns rkey
@@ -11921,8 +11887,8 @@ interface OneBotMessageApi {
11921
11887
  params: {
11922
11888
  group_id: number;
11923
11889
  message_id: number;
11924
- emoji_id: string;
11925
- set: boolean;
11890
+ code: string;
11891
+ is_add: boolean;
11926
11892
  };
11927
11893
  response: null;
11928
11894
  };
@@ -14285,11 +14251,11 @@ declare abstract class OneBotCore extends EventEmitter$1 {
14285
14251
  * Lagrange扩展: 给消息添加表情回应
14286
14252
  * @param group_id - 群ID
14287
14253
  * @param message_id - 消息ID
14288
- * @param emoji_id - 表情ID
14289
- * @param set - 设置或取消
14254
+ * @param code - 表情ID
14255
+ * @param is_add - 是否为添加
14290
14256
  * @returns
14291
14257
  */
14292
- lgl_setGroupReaction(group_id: number, message_id: number, emoji_id: string, set: boolean): Promise<null>;
14258
+ lgl_setGroupReaction(group_id: number, message_id: number, code: string, is_add: boolean): Promise<null>;
14293
14259
  /**
14294
14260
  * NapCat扩展: 给消息添加表情回应
14295
14261
  * @param message_id - 消息ID
@@ -15689,8 +15655,6 @@ type OneBotHttpClientOptions = {
15689
15655
  headers?: Record<string, string>;
15690
15656
  /** 最大重连次数 默认100次 */
15691
15657
  maxReconnectAttempts?: number;
15692
- /** 发送第一次心跳时间`(触发OPEN事件)` 默认200ms */
15693
- firstHeartbeatTimeout?: number;
15694
15658
  } & OneBotCore['_options'];
15695
15659
  /** http客户端内部配置 */
15696
15660
  type OneBotHttpClientInternalOptions = Required<Omit<OneBotHttpClientOptions, 'firstHeartbeatTimeout'>>;
@@ -15950,6 +15914,7 @@ declare class OneBotWsServer extends OneBotWsBase {
15950
15914
  /** 请求对象 */
15951
15915
  private _request;
15952
15916
  constructor(socket: WebSocket, request: IncomingMessage, options: OneBotWsServerOptions$1);
15917
+ init(): Promise<void>;
15953
15918
  /**
15954
15919
  * 更新socket
15955
15920
  */
@@ -16057,7 +16022,7 @@ declare class AdapterOneBot<T extends OneBotType> extends AdapterBase {
16057
16022
  * @param contact ob11无需提供contact参数
16058
16023
  * @param messageId 消息ID
16059
16024
  */
16060
- recallMsg(_: Contact, messageId: string): Promise<boolean>;
16025
+ recallMsg(_: Contact, messageId: string): Promise<void>;
16061
16026
  /**
16062
16027
  * 获取消息
16063
16028
  * @param contact 联系人信息
@@ -16120,7 +16085,7 @@ declare class AdapterOneBot<T extends OneBotType> extends AdapterBase {
16120
16085
  * @param count 赞的次数
16121
16086
  * @returns 此接口的返回值不值得信任
16122
16087
  */
16123
- sendLike(targetId: string, count: number): Promise<boolean>;
16088
+ sendLike(targetId: string, count: number): Promise<void>;
16124
16089
  /**
16125
16090
  * 群踢人
16126
16091
  * @param groupId 群ID
@@ -16129,7 +16094,7 @@ declare class AdapterOneBot<T extends OneBotType> extends AdapterBase {
16129
16094
  * @param kickReason 踢出原因,可选
16130
16095
  * @returns 此接口的返回值不值得信任
16131
16096
  */
16132
- groupKickMember(groupId: string, targetId: string, rejectAddRequest?: boolean, _?: string): Promise<boolean>;
16097
+ groupKickMember(groupId: string, targetId: string, rejectAddRequest?: boolean, _?: string): Promise<void>;
16133
16098
  /**
16134
16099
  * 禁言群成员
16135
16100
  * @param groupId 群ID
@@ -16137,14 +16102,14 @@ declare class AdapterOneBot<T extends OneBotType> extends AdapterBase {
16137
16102
  * @param duration 禁言时长 单位:秒
16138
16103
  * @returns 此接口的返回值不值得信任
16139
16104
  */
16140
- setGroupMute(groupId: string, targetId: string, duration: number): Promise<boolean>;
16105
+ setGroupMute(groupId: string, targetId: string, duration: number): Promise<void>;
16141
16106
  /**
16142
16107
  * 群全员禁言
16143
16108
  * @param groupId 群ID
16144
16109
  * @param isBan 是否开启全员禁言
16145
16110
  * @returns 此接口的返回值不值得信任
16146
16111
  */
16147
- setGroupAllMute(groupId: string, isBan: boolean): Promise<boolean>;
16112
+ setGroupAllMute(groupId: string, isBan: boolean): Promise<void>;
16148
16113
  /**
16149
16114
  * 设置群管理员
16150
16115
  * @param groupId 群ID
@@ -16152,7 +16117,7 @@ declare class AdapterOneBot<T extends OneBotType> extends AdapterBase {
16152
16117
  * @param isAdmin 是否设置为管理员
16153
16118
  * @returns 此接口的返回值不值得信任
16154
16119
  */
16155
- setGroupAdmin(groupId: string, targetId: string, isAdmin: boolean): Promise<boolean>;
16120
+ setGroupAdmin(groupId: string, targetId: string, isAdmin: boolean): Promise<void>;
16156
16121
  /**
16157
16122
  * 设置群名片
16158
16123
  * @param groupId 群ID
@@ -16160,21 +16125,21 @@ declare class AdapterOneBot<T extends OneBotType> extends AdapterBase {
16160
16125
  * @param card 新的群名片
16161
16126
  * @returns 此接口的返回值不值得信任
16162
16127
  */
16163
- setGroupMemberCard(groupId: string, targetId: string, card: string): Promise<boolean>;
16128
+ setGroupMemberCard(groupId: string, targetId: string, card: string): Promise<void>;
16164
16129
  /**
16165
16130
  * 设置群名
16166
16131
  * @param groupId 群ID
16167
16132
  * @param groupName 新的群名
16168
16133
  * @returns 此接口的返回值不值得信任
16169
16134
  */
16170
- setGroupName(groupId: string, groupName: string): Promise<boolean>;
16135
+ setGroupName(groupId: string, groupName: string): Promise<void>;
16171
16136
  /**
16172
16137
  * 退出群组
16173
16138
  * @param groupId 群ID
16174
16139
  * @param isDismiss 如果Bot是群主,是否解散群
16175
16140
  * @returns 此接口的返回值不值得信任
16176
16141
  */
16177
- setGroupQuit(groupId: string, isDismiss: boolean): Promise<boolean>;
16142
+ setGroupQuit(groupId: string, isDismiss: boolean): Promise<void>;
16178
16143
  /**
16179
16144
  * 设置群专属头衔 仅群主可用
16180
16145
  * @param groupId 群ID
@@ -16182,7 +16147,7 @@ declare class AdapterOneBot<T extends OneBotType> extends AdapterBase {
16182
16147
  * @param title 新的专属头衔
16183
16148
  * @returns 此接口的返回值不值得信任
16184
16149
  */
16185
- setGroupMemberTitle(groupId: string, targetId: string, title: string): Promise<boolean>;
16150
+ setGroupMemberTitle(groupId: string, targetId: string, title: string): Promise<void>;
16186
16151
  /**
16187
16152
  * 获取陌生人信息
16188
16153
  * @param targetId 用户ID 任选其一
@@ -16462,7 +16427,7 @@ declare class AdapterOneBot<T extends OneBotType> extends AdapterBase {
16462
16427
  * @param faceId 表情ID
16463
16428
  * @returns 此接口的返回值不值得信任
16464
16429
  */
16465
- setMsgReaction(contact: Contact, messageId: string, faceId: number, isSet: boolean): Promise<boolean>;
16430
+ setMsgReaction(contact: Contact, messageId: string, faceId: number, isSet: boolean): Promise<void>;
16466
16431
  /**
16467
16432
  * 获取版本信息
16468
16433
  */
@@ -16502,14 +16467,14 @@ declare class AdapterOneBot<T extends OneBotType> extends AdapterBase {
16502
16467
  * @param folder 父目录ID 不提供则上传到根目录 仅在群聊时有效
16503
16468
  * @returns 此接口的返回值不值得信任
16504
16469
  */
16505
- uploadFile(contact: Contact, file: string, name: string, folder?: string): Promise<boolean>;
16470
+ uploadFile(contact: Contact, file: string, name: string, folder?: string): Promise<void>;
16506
16471
  /**
16507
16472
  * 设置、取消群精华消息
16508
16473
  * @param groupId 群ID
16509
16474
  * @param messageId 群消息ID
16510
16475
  * @param create true为添加精华消息,false为删除精华消息 默认为true
16511
16476
  */
16512
- setGgroupHighlights(_: string, messageId: string, create: boolean): Promise<boolean>;
16477
+ setGgroupHighlights(_: string, messageId: string, create: boolean): Promise<void>;
16513
16478
  PokeMember(_: string, __: string): Promise<void>;
16514
16479
  /**
16515
16480
  * 设置好友请求结果
@@ -16518,7 +16483,7 @@ declare class AdapterOneBot<T extends OneBotType> extends AdapterBase {
16518
16483
  * @param remark 好友备注 同意时有效
16519
16484
  * @returns 设置结果
16520
16485
  */
16521
- setFriendApplyResult(requestId: string, isApprove: boolean, remark?: string): Promise<boolean>;
16486
+ setFriendApplyResult(requestId: string, isApprove: boolean, remark?: string): Promise<void>;
16522
16487
  /**
16523
16488
  * 设置申请加入群请求结果
16524
16489
  * @param requestId 请求事件ID
@@ -16526,14 +16491,14 @@ declare class AdapterOneBot<T extends OneBotType> extends AdapterBase {
16526
16491
  * @param denyReason 拒绝理由 拒绝时有效
16527
16492
  * @returns 此接口的返回值不值得信任
16528
16493
  */
16529
- setGroupApplyResult(requestId: string, isApprove: boolean, denyReason?: string): Promise<boolean>;
16494
+ setGroupApplyResult(requestId: string, isApprove: boolean, denyReason?: string): Promise<void>;
16530
16495
  /**
16531
16496
  * 设置邀请加入群请求结果
16532
16497
  * @param requestId 请求事件ID
16533
16498
  * @param isApprove 是否同意
16534
16499
  * @returns 此接口的返回值不值得信任
16535
16500
  */
16536
- setInvitedJoinGroupResult(requestId: string, isApprove: boolean): Promise<boolean>;
16501
+ setInvitedJoinGroupResult(requestId: string, isApprove: boolean): Promise<void>;
16537
16502
  /**
16538
16503
  * 合并转发 karin -> adapter
16539
16504
  * @param elements 消息元素
@@ -16634,7 +16599,7 @@ declare class AdapterOneBot<T extends OneBotType> extends AdapterBase {
16634
16599
  * @param file base64:// file:// http(s)://
16635
16600
  * @returns 是否设置成功
16636
16601
  */
16637
- setAvatar(file: string): Promise<boolean>;
16602
+ setAvatar(file: string): Promise<void>;
16638
16603
  /**
16639
16604
  * 获取群 Ai 语音可用声色列表
16640
16605
  * @returns 声色列表
package/dist/index.mjs CHANGED
@@ -2507,7 +2507,6 @@ var init_base = __esm({
2507
2507
  * 撤回消息
2508
2508
  * @param _contact 目标信息
2509
2509
  * @param _messageId 消息ID
2510
- * @returns 此接口的返回值不值得信任
2511
2510
  */
2512
2511
  recallMsg(_contact, _messageId) {
2513
2512
  throw new Error(this.#errMsg);
@@ -2583,14 +2582,13 @@ var init_base = __esm({
2583
2582
  * @param _messageId 群消息ID
2584
2583
  * @param _create true为添加精华消息,false为删除精华消息 默认为true
2585
2584
  */
2586
- setGgroupHighlights(_groupId, _messageId, _create) {
2585
+ setGroupHighlights(_groupId, _messageId, _create) {
2587
2586
  throw new Error(this.#errMsg);
2588
2587
  }
2589
2588
  /**
2590
2589
  * 发送好友赞
2591
2590
  * @param _targetId 目标ID
2592
2591
  * @param _count 赞的次数
2593
- * @returns 此接口的返回值不值得信任
2594
2592
  */
2595
2593
  sendLike(_targetId, _count) {
2596
2594
  throw new Error(this.#errMsg);
@@ -2601,7 +2599,6 @@ var init_base = __esm({
2601
2599
  * @param _targetId 被踢出目标的ID 任选其一
2602
2600
  * @param _rejectAddRequest 是否拒绝再次申请,默认为false
2603
2601
  * @param _kickReason 踢出原因,可选
2604
- * @returns 此接口的返回值不值得信任
2605
2602
  */
2606
2603
  groupKickMember(_groupId, _targetId, _rejectAddRequest, _kickReason) {
2607
2604
  throw new Error(this.#errMsg);
@@ -2611,7 +2608,6 @@ var init_base = __esm({
2611
2608
  * @param _groupId 群ID
2612
2609
  * @param _targetId 被禁言目标的ID 任选其一
2613
2610
  * @param _duration 禁言时长 单位:秒
2614
- * @returns 此接口的返回值不值得信任
2615
2611
  */
2616
2612
  setGroupMute(_groupId, _targetId, _duration) {
2617
2613
  throw new Error(this.#errMsg);
@@ -2620,7 +2616,6 @@ var init_base = __esm({
2620
2616
  * 群全员禁言
2621
2617
  * @param _groupId 群ID
2622
2618
  * @param _isBan 是否开启全员禁言
2623
- * @returns 此接口的返回值不值得信任
2624
2619
  */
2625
2620
  setGroupAllMute(_groupId, _isBan) {
2626
2621
  throw new Error(this.#errMsg);
@@ -2630,7 +2625,6 @@ var init_base = __esm({
2630
2625
  * @param _groupId 群ID
2631
2626
  * @param _targetId 目标用户的ID
2632
2627
  * @param _isAdmin 是否设置为管理员
2633
- * @returns 此接口的返回值不值得信任
2634
2628
  */
2635
2629
  setGroupAdmin(_groupId, _targetId, _isAdmin) {
2636
2630
  throw new Error(this.#errMsg);
@@ -2640,7 +2634,6 @@ var init_base = __esm({
2640
2634
  * @param _groupId 群ID
2641
2635
  * @param _targetId 目标用户的ID
2642
2636
  * @param _card 新的群名片
2643
- * @returns 此接口的返回值不值得信任
2644
2637
  */
2645
2638
  setGroupMemberCard(_groupId, _targetId, _card) {
2646
2639
  throw new Error(this.#errMsg);
@@ -2649,7 +2642,6 @@ var init_base = __esm({
2649
2642
  * 设置群名
2650
2643
  * @param _groupId 群ID
2651
2644
  * @param _groupName 新的群名
2652
- * @returns 此接口的返回值不值得信任
2653
2645
  */
2654
2646
  setGroupName(_groupId, _groupName) {
2655
2647
  throw new Error(this.#errMsg);
@@ -2658,7 +2650,6 @@ var init_base = __esm({
2658
2650
  * 退出群组
2659
2651
  * @param _groupId 群ID
2660
2652
  * @param _isDismiss 如果Bot是群主,是否解散群
2661
- * @returns 此接口的返回值不值得信任
2662
2653
  */
2663
2654
  setGroupQuit(_groupId, _isDismiss) {
2664
2655
  throw new Error(this.#errMsg);
@@ -2668,7 +2659,6 @@ var init_base = __esm({
2668
2659
  * @param _groupId 群ID
2669
2660
  * @param _targetId 目标用户的ID
2670
2661
  * @param _title 新的专属头衔
2671
- * @returns 此接口的返回值不值得信任
2672
2662
  */
2673
2663
  setGroupMemberTitle(_groupId, _targetId, _title) {
2674
2664
  throw new Error(this.#errMsg);
@@ -2740,7 +2730,6 @@ var init_base = __esm({
2740
2730
  * @param _requestId 请求事件ID
2741
2731
  * @param _isApprove 是否同意
2742
2732
  * @param _remark 好友备注 同意时有效
2743
- * @returns 设置结果
2744
2733
  */
2745
2734
  setFriendApplyResult(_requestId, _isApprove, _remark) {
2746
2735
  throw new Error(this.#errMsg);
@@ -2750,7 +2739,6 @@ var init_base = __esm({
2750
2739
  * @param _requestId 请求事件ID
2751
2740
  * @param _isApprove 是否同意
2752
2741
  * @param _denyReason 拒绝理由 拒绝时有效
2753
- * @returns 此接口的返回值不值得信任
2754
2742
  */
2755
2743
  setGroupApplyResult(_requestId, _isApprove, _denyReason) {
2756
2744
  throw new Error(this.#errMsg);
@@ -2759,7 +2747,6 @@ var init_base = __esm({
2759
2747
  * 设置邀请加入群请求结果
2760
2748
  * @param _requestId 请求事件ID
2761
2749
  * @param _isApprove 是否同意
2762
- * @returns 此接口的返回值不值得信任
2763
2750
  */
2764
2751
  setInvitedJoinGroupResult(_requestId, _isApprove) {
2765
2752
  throw new Error(this.#errMsg);
@@ -2769,7 +2756,6 @@ var init_base = __esm({
2769
2756
  * @param _contact 目标信息
2770
2757
  * @param _messageId 消息ID
2771
2758
  * @param _faceId 表情ID
2772
- * @returns 此接口的返回值不值得信任
2773
2759
  */
2774
2760
  setMsgReaction(_contact, _messageId, _faceId, _isSet) {
2775
2761
  throw new Error(this.#errMsg);
@@ -2780,7 +2766,6 @@ var init_base = __esm({
2780
2766
  * @param _file 本地文件绝对路径
2781
2767
  * @param _name 文件名称 必须提供
2782
2768
  * @param _folder 父目录ID 不提供则上传到根目录 仅在群聊时有效
2783
- * @returns 此接口的返回值不值得信任
2784
2769
  */
2785
2770
  uploadFile(_contact, _file, _name, _folder) {
2786
2771
  throw new Error(this.#errMsg);
@@ -2872,7 +2857,6 @@ var init_base = __esm({
2872
2857
  * 设置群备注
2873
2858
  * @param _groupId 群号
2874
2859
  * @param _remark 新的备注
2875
- * @returns 此接口的返回值不值得信任
2876
2860
  */
2877
2861
  setGroupRemark(_groupId, _remark) {
2878
2862
  throw new Error(this.#errMsg);
@@ -2904,7 +2888,6 @@ var init_base = __esm({
2904
2888
  * 戳一戳用户 支持群聊和私聊
2905
2889
  * @param _contact 目标信息
2906
2890
  * @param _count 戳一戳次数 默认为1
2907
- * @returns 此接口的返回值不值得信任
2908
2891
  */
2909
2892
  pokeUser(_contact, _count) {
2910
2893
  throw new Error(this.#errMsg);
@@ -2932,7 +2915,6 @@ var init_base = __esm({
2932
2915
  /**
2933
2916
  * 设置头像
2934
2917
  * @param file base64:// file:// http(s)://
2935
- * @returns 是否设置成功
2936
2918
  */
2937
2919
  setAvatar(_file) {
2938
2920
  throw new Error(this.#errMsg);
@@ -3345,12 +3327,14 @@ var init_dist2 = __esm({
3345
3327
  * 格式化Api返回错误
3346
3328
  */
3347
3329
  _formatApiError(action, params, error) {
3348
- return new Error([
3349
- `[${this.self_id}][sendApi] \u8BF7\u6C42\u9519\u8BEF:`,
3350
- ` action: ${action}`,
3351
- ` params: ${this._formatBase64(params)}`,
3352
- ` error: ${error}`
3353
- ].join("\n"));
3330
+ return new Error(
3331
+ [
3332
+ `[${this.self_id}][sendApi] \u8BF7\u6C42\u9519\u8BEF:`,
3333
+ ` action: ${action}`,
3334
+ ` params: ${this._formatBase64(params)}`
3335
+ ].join("\n"),
3336
+ { cause: error }
3337
+ );
3354
3338
  }
3355
3339
  /**
3356
3340
  * 初始化Bot基本信息
@@ -3835,16 +3819,16 @@ var init_dist2 = __esm({
3835
3819
  * Lagrange扩展: 给消息添加表情回应
3836
3820
  * @param group_id - 群ID
3837
3821
  * @param message_id - 消息ID
3838
- * @param emoji_id - 表情ID
3839
- * @param set - 设置或取消
3822
+ * @param code - 表情ID
3823
+ * @param is_add - 是否为添加
3840
3824
  * @returns
3841
3825
  */
3842
- async lgl_setGroupReaction(group_id, message_id, emoji_id, set) {
3826
+ async lgl_setGroupReaction(group_id, message_id, code, is_add) {
3843
3827
  return this.sendApi("set_group_reaction", {
3844
3828
  group_id,
3845
3829
  message_id,
3846
- emoji_id,
3847
- set
3830
+ code,
3831
+ is_add
3848
3832
  });
3849
3833
  }
3850
3834
  /**
@@ -5235,18 +5219,14 @@ var init_dist2 = __esm({
5235
5219
  * 关闭连接
5236
5220
  */
5237
5221
  close() {
5238
- try {
5239
- this._manualClosed = true;
5240
- this._socket.close();
5241
- this.emit(
5242
- "close",
5243
- 1002
5244
- /* MANUAL_CLOSE */
5245
- );
5246
- setTimeout(() => this.removeAllListeners(), 200);
5247
- } finally {
5248
- this._manualClosed = false;
5249
- }
5222
+ this._manualClosed = true;
5223
+ this._socket.close();
5224
+ this.emit(
5225
+ "close",
5226
+ 1002
5227
+ /* MANUAL_CLOSE */
5228
+ );
5229
+ this.removeAllListeners();
5250
5230
  }
5251
5231
  /**
5252
5232
  * 更新socket
@@ -5456,6 +5436,7 @@ var init_dist2 = __esm({
5456
5436
  * @returns 是否重连成功
5457
5437
  */
5458
5438
  async reconnect(url, options = this._options) {
5439
+ this._manualClosed = false;
5459
5440
  this._options = this.getOptions(options);
5460
5441
  const _socket = oneBotWsClientManager.createWebSocket(url, options);
5461
5442
  this.setSocket(_socket)();
@@ -5478,13 +5459,7 @@ var init_dist2 = __esm({
5478
5459
  });
5479
5460
  this._socket.on("close", () => {
5480
5461
  if (this._setSocket) return;
5481
- if (this._manualClosed) {
5482
- this.#close(
5483
- 1002
5484
- /* MANUAL_CLOSE */
5485
- );
5486
- return;
5487
- }
5462
+ if (this._manualClosed) return;
5488
5463
  if (this._options.autoReconnect) {
5489
5464
  if (isConnected) {
5490
5465
  this.#close(
@@ -5556,7 +5531,10 @@ var init_dist2 = __esm({
5556
5531
  super(socket, options);
5557
5532
  this._options = this.getOptions(options);
5558
5533
  this._request = request22;
5534
+ }
5535
+ async init() {
5559
5536
  this._setupEventListeners();
5537
+ await super.init();
5560
5538
  }
5561
5539
  /**
5562
5540
  * 关闭之前的一些操作
@@ -5606,15 +5584,13 @@ var init_dist2 = __esm({
5606
5584
  */
5607
5585
  _setupEventListeners() {
5608
5586
  this?._socket?.removeAllListeners();
5587
+ this.emit(
5588
+ "open"
5589
+ /* OPEN */
5590
+ );
5609
5591
  this._socket.on("close", () => {
5610
5592
  if (this._setSocket) return;
5611
- if (this._manualClosed) {
5612
- this.#close(
5613
- 1002
5614
- /* MANUAL_CLOSE */
5615
- );
5616
- return;
5617
- }
5593
+ if (this._manualClosed) return;
5618
5594
  this.#close(
5619
5595
  1001
5620
5596
  /* ERROR */
@@ -5705,8 +5681,6 @@ var init_dist2 = __esm({
5705
5681
  super(options);
5706
5682
  this._options = this.getOptions(options);
5707
5683
  this.self.id = options.self_id;
5708
- const firstHeartbeatTimeout = options.firstHeartbeatTimeout || 200;
5709
- setTimeout(() => this._sendFirstHeartbeat(), firstHeartbeatTimeout);
5710
5684
  }
5711
5685
  /**
5712
5686
  * 发送第一次心跳
@@ -5719,11 +5693,6 @@ var init_dist2 = __esm({
5719
5693
  error: new Error(`\u53D1\u9001\u7B2C\u4E00\u6B21\u5FC3\u8DF3\u5931\u8D25: \u8BF7\u68C0\u67E5\u76EE\u6807\u5730\u5740\u662F\u5426\u53EF\u8BBF\u95EE: ${this._options.httpHost}`, { cause: error })
5720
5694
  });
5721
5695
  }
5722
- this._initialized = true;
5723
- this.emit(
5724
- "open"
5725
- /* OPEN */
5726
- );
5727
5696
  }
5728
5697
  /**
5729
5698
  * 获取格式化后的配置
@@ -5842,12 +5811,11 @@ var init_dist2 = __esm({
5842
5811
  * 初始化
5843
5812
  */
5844
5813
  async init() {
5845
- if (this._initialized) {
5846
- return;
5847
- }
5848
- this._startHeartbeat();
5814
+ if (this._initialized) return;
5815
+ await this._sendFirstHeartbeat();
5849
5816
  await this._initBotInfo();
5850
5817
  this._initialized = true;
5818
+ this._startHeartbeat();
5851
5819
  this.emit(
5852
5820
  "open"
5853
5821
  /* OPEN */
@@ -5926,7 +5894,6 @@ var init_dist2 = __esm({
5926
5894
  */
5927
5895
  async reconnect() {
5928
5896
  this._initialized = false;
5929
- await this._sendFirstHeartbeat();
5930
5897
  await this.init();
5931
5898
  }
5932
5899
  };
@@ -17776,7 +17743,7 @@ var init_core = __esm({
17776
17743
  * 注册机器人
17777
17744
  */
17778
17745
  registerBot() {
17779
- logger.bot("info", this.selfId, `[onebot11][${this.adapter.communication}] \u8FDE\u63A5\u6210\u529F: ${this.adapter.address}`);
17746
+ logger.bot("info", this.selfId, `[OneBot][${this.adapter.communication}] \u8FDE\u63A5\u6210\u529F: ${this.adapter.address}`);
17780
17747
  this.adapter.index = registerBot(this.adapter.communication, this);
17781
17748
  }
17782
17749
  /**
@@ -17945,12 +17912,7 @@ var init_core = __esm({
17945
17912
  * @param messageId 消息ID
17946
17913
  */
17947
17914
  async recallMsg(_, messageId) {
17948
- try {
17949
- await this._onebot.deleteMsg(Number(messageId));
17950
- return true;
17951
- } catch {
17952
- return false;
17953
- }
17915
+ await this._onebot.deleteMsg(Number(messageId));
17954
17916
  }
17955
17917
  /**
17956
17918
  * 获取消息
@@ -18073,12 +18035,7 @@ var init_core = __esm({
18073
18035
  * @returns 此接口的返回值不值得信任
18074
18036
  */
18075
18037
  async sendLike(targetId, count3) {
18076
- try {
18077
- await this._onebot.sendLike(Number(targetId), count3);
18078
- return true;
18079
- } catch {
18080
- return false;
18081
- }
18038
+ await this._onebot.sendLike(Number(targetId), count3);
18082
18039
  }
18083
18040
  /**
18084
18041
  * 群踢人
@@ -18089,12 +18046,7 @@ var init_core = __esm({
18089
18046
  * @returns 此接口的返回值不值得信任
18090
18047
  */
18091
18048
  async groupKickMember(groupId, targetId, rejectAddRequest, _) {
18092
- try {
18093
- await this._onebot.setGroupKick(Number(groupId), Number(targetId), rejectAddRequest);
18094
- return true;
18095
- } catch {
18096
- return false;
18097
- }
18049
+ await this._onebot.setGroupKick(Number(groupId), Number(targetId), rejectAddRequest);
18098
18050
  }
18099
18051
  /**
18100
18052
  * 禁言群成员
@@ -18104,12 +18056,7 @@ var init_core = __esm({
18104
18056
  * @returns 此接口的返回值不值得信任
18105
18057
  */
18106
18058
  async setGroupMute(groupId, targetId, duration) {
18107
- try {
18108
- await this._onebot.setGroupBan(Number(groupId), Number(targetId), duration);
18109
- return true;
18110
- } catch {
18111
- return false;
18112
- }
18059
+ await this._onebot.setGroupBan(Number(groupId), Number(targetId), duration);
18113
18060
  }
18114
18061
  /**
18115
18062
  * 群全员禁言
@@ -18118,12 +18065,7 @@ var init_core = __esm({
18118
18065
  * @returns 此接口的返回值不值得信任
18119
18066
  */
18120
18067
  async setGroupAllMute(groupId, isBan) {
18121
- try {
18122
- await this._onebot.setGroupWholeBan(Number(groupId), isBan);
18123
- return true;
18124
- } catch {
18125
- return false;
18126
- }
18068
+ await this._onebot.setGroupWholeBan(Number(groupId), isBan);
18127
18069
  }
18128
18070
  /**
18129
18071
  * 设置群管理员
@@ -18133,12 +18075,7 @@ var init_core = __esm({
18133
18075
  * @returns 此接口的返回值不值得信任
18134
18076
  */
18135
18077
  async setGroupAdmin(groupId, targetId, isAdmin) {
18136
- try {
18137
- await this._onebot.setGroupAdmin(Number(groupId), Number(targetId), isAdmin);
18138
- return true;
18139
- } catch {
18140
- return false;
18141
- }
18078
+ await this._onebot.setGroupAdmin(Number(groupId), Number(targetId), isAdmin);
18142
18079
  }
18143
18080
  /**
18144
18081
  * 设置群名片
@@ -18148,12 +18085,7 @@ var init_core = __esm({
18148
18085
  * @returns 此接口的返回值不值得信任
18149
18086
  */
18150
18087
  async setGroupMemberCard(groupId, targetId, card) {
18151
- try {
18152
- await this._onebot.setGroupCard(Number(groupId), Number(targetId), card);
18153
- return true;
18154
- } catch {
18155
- return false;
18156
- }
18088
+ await this._onebot.setGroupCard(Number(groupId), Number(targetId), card);
18157
18089
  }
18158
18090
  /**
18159
18091
  * 设置群名
@@ -18162,12 +18094,7 @@ var init_core = __esm({
18162
18094
  * @returns 此接口的返回值不值得信任
18163
18095
  */
18164
18096
  async setGroupName(groupId, groupName) {
18165
- try {
18166
- await this._onebot.setGroupName(Number(groupId), groupName);
18167
- return true;
18168
- } catch {
18169
- return false;
18170
- }
18097
+ await this._onebot.setGroupName(Number(groupId), groupName);
18171
18098
  }
18172
18099
  /**
18173
18100
  * 退出群组
@@ -18176,12 +18103,7 @@ var init_core = __esm({
18176
18103
  * @returns 此接口的返回值不值得信任
18177
18104
  */
18178
18105
  async setGroupQuit(groupId, isDismiss) {
18179
- try {
18180
- await this._onebot.setGroupLeave(Number(groupId), isDismiss);
18181
- return true;
18182
- } catch {
18183
- return false;
18184
- }
18106
+ await this._onebot.setGroupLeave(Number(groupId), isDismiss);
18185
18107
  }
18186
18108
  /**
18187
18109
  * 设置群专属头衔 仅群主可用
@@ -18191,12 +18113,7 @@ var init_core = __esm({
18191
18113
  * @returns 此接口的返回值不值得信任
18192
18114
  */
18193
18115
  async setGroupMemberTitle(groupId, targetId, title) {
18194
- try {
18195
- await this._onebot.setGroupSpecialTitle(Number(groupId), Number(targetId), title);
18196
- return true;
18197
- } catch {
18198
- return false;
18199
- }
18116
+ await this._onebot.setGroupSpecialTitle(Number(groupId), Number(targetId), title);
18200
18117
  }
18201
18118
  /**
18202
18119
  * 获取陌生人信息
@@ -18531,19 +18448,15 @@ var init_core = __esm({
18531
18448
  * @returns 此接口的返回值不值得信任
18532
18449
  */
18533
18450
  async setMsgReaction(contact3, messageId, faceId, isSet) {
18534
- try {
18535
- if (this.adapter.name === "Lagrange.OneBot") {
18536
- await this._onebot.lgl_setGroupReaction(+contact3.peer, +messageId, faceId + "", isSet);
18537
- return true;
18538
- }
18539
- if (this.adapter.name === "NapCat.OneBot") {
18540
- await this._onebot.nc_setMsgEmojiLike(+messageId, faceId + "", isSet);
18541
- return true;
18542
- }
18543
- throw new Error(`${this.adapter.name} \u4E0D\u652F\u6301\u8BBE\u7F6E\u6D88\u606F\u8868\u60C5\u56DE\u5E94`);
18544
- } catch {
18545
- return false;
18451
+ if (this.adapter.name === "Lagrange.OneBot") {
18452
+ await this._onebot.lgl_setGroupReaction(+contact3.peer, +messageId, faceId + "", isSet);
18453
+ return;
18454
+ }
18455
+ if (this.adapter.name === "NapCat.OneBot") {
18456
+ await this._onebot.nc_setMsgEmojiLike(+messageId, faceId + "", isSet);
18457
+ return;
18546
18458
  }
18459
+ throw new Error(`${this.adapter.name} \u4E0D\u652F\u6301\u8BBE\u7F6E\u6D88\u606F\u8868\u60C5\u56DE\u5E94`);
18547
18460
  }
18548
18461
  /**
18549
18462
  * 获取版本信息
@@ -18628,16 +18541,11 @@ var init_core = __esm({
18628
18541
  * @returns 此接口的返回值不值得信任
18629
18542
  */
18630
18543
  async uploadFile(contact3, file2, name, folder) {
18631
- try {
18632
- if (contact3.scene === "group") {
18633
- await this._onebot.uploadGroupFile(+contact3.peer, file2, name, folder);
18634
- } else {
18635
- await this._onebot.uploadPrivateFile(+contact3.peer, file2, name);
18636
- }
18637
- return true;
18638
- } catch {
18639
- return false;
18544
+ if (contact3.scene === "group") {
18545
+ await this._onebot.uploadGroupFile(+contact3.peer, file2, name, folder);
18546
+ return;
18640
18547
  }
18548
+ await this._onebot.uploadPrivateFile(+contact3.peer, file2, name);
18641
18549
  }
18642
18550
  /**
18643
18551
  * 设置、取消群精华消息
@@ -18646,15 +18554,10 @@ var init_core = __esm({
18646
18554
  * @param create true为添加精华消息,false为删除精华消息 默认为true
18647
18555
  */
18648
18556
  async setGgroupHighlights(_, messageId, create2) {
18649
- try {
18650
- if (create2) {
18651
- await this._onebot.setEssenceMsg(+messageId);
18652
- } else {
18653
- await this._onebot.deleteEssenceMsg(+messageId);
18654
- }
18655
- return true;
18656
- } catch {
18657
- return false;
18557
+ if (create2) {
18558
+ await this._onebot.setEssenceMsg(+messageId);
18559
+ } else {
18560
+ await this._onebot.deleteEssenceMsg(+messageId);
18658
18561
  }
18659
18562
  }
18660
18563
  async PokeMember(_, __) {
@@ -18668,12 +18571,7 @@ var init_core = __esm({
18668
18571
  * @returns 设置结果
18669
18572
  */
18670
18573
  async setFriendApplyResult(requestId, isApprove, remark) {
18671
- try {
18672
- await this._onebot.setFriendAddRequest(requestId, isApprove, remark);
18673
- return true;
18674
- } catch {
18675
- return false;
18676
- }
18574
+ await this._onebot.setFriendAddRequest(requestId, isApprove, remark);
18677
18575
  }
18678
18576
  /**
18679
18577
  * 设置申请加入群请求结果
@@ -18683,12 +18581,7 @@ var init_core = __esm({
18683
18581
  * @returns 此接口的返回值不值得信任
18684
18582
  */
18685
18583
  async setGroupApplyResult(requestId, isApprove, denyReason) {
18686
- try {
18687
- await this._onebot.setGroupAddRequest(requestId, "add", isApprove, denyReason);
18688
- return true;
18689
- } catch {
18690
- return false;
18691
- }
18584
+ await this._onebot.setGroupAddRequest(requestId, "add", isApprove, denyReason);
18692
18585
  }
18693
18586
  /**
18694
18587
  * 设置邀请加入群请求结果
@@ -18697,12 +18590,7 @@ var init_core = __esm({
18697
18590
  * @returns 此接口的返回值不值得信任
18698
18591
  */
18699
18592
  async setInvitedJoinGroupResult(requestId, isApprove) {
18700
- try {
18701
- await this._onebot.setGroupAddRequest(requestId, "invite", isApprove);
18702
- return true;
18703
- } catch {
18704
- return false;
18705
- }
18593
+ await this._onebot.setGroupAddRequest(requestId, "invite", isApprove);
18706
18594
  }
18707
18595
  /**
18708
18596
  * 合并转发 karin -> adapter
@@ -18866,12 +18754,7 @@ var init_core = __esm({
18866
18754
  * @returns 是否设置成功
18867
18755
  */
18868
18756
  async setAvatar(file2) {
18869
- try {
18870
- await this._onebot.setQqAvatar(file2);
18871
- return true;
18872
- } catch {
18873
- return false;
18874
- }
18757
+ await this._onebot.setQqAvatar(file2);
18875
18758
  }
18876
18759
  /**
18877
18760
  * 获取群 Ai 语音可用声色列表
@@ -18926,6 +18809,10 @@ var init_create2 = __esm({
18926
18809
  adapter3.adapter.address = url;
18927
18810
  adapter3.adapter.communication = "webSocketServer";
18928
18811
  adapter3.account.selfId = String(request3.headers["x-self-id"]);
18812
+ onebot.on(OneBotEventKey.OPEN, async () => {
18813
+ logger.debug(`[OneBot] \u670D\u52A1\u7AEF\u8FDE\u63A5\u6210\u529F: ${url}`);
18814
+ adapter3.registerBot();
18815
+ });
18929
18816
  onebot.on(OneBotEventKey.CLOSE, async (type) => {
18930
18817
  adapter3.unregisterBot();
18931
18818
  if (type === OneBotCloseType.MANUAL_CLOSE) {
@@ -18933,6 +18820,15 @@ var init_create2 = __esm({
18933
18820
  }
18934
18821
  return logger.error(`${loggerPrefix} \u8FDE\u63A5\u65AD\u5F00: ${url}`);
18935
18822
  });
18823
+ onebot.on(OneBotEventKey.ERROR, async (args) => {
18824
+ if (args.type === OneBotErrorType.AUTH_FAILED) {
18825
+ return logger.error(`${loggerPrefix} \u9274\u6743\u5931\u8D25: ${args.error.message}`);
18826
+ }
18827
+ if (args.type === OneBotErrorType.AUTH_INVALID_FORMAT) {
18828
+ return logger.error(`${loggerPrefix} \u9274\u6743\u5934\u683C\u5F0F\u9519\u8BEF: ${args.error.message}`);
18829
+ }
18830
+ return logger.error(new Error(`${loggerPrefix} \u53D1\u751F\u9519\u8BEF:`, { cause: args.error }));
18831
+ });
18936
18832
  await adapter3.init();
18937
18833
  cacheMap.wsServer.set(url, adapter3);
18938
18834
  };
@@ -18997,8 +18893,6 @@ var init_create2 = __esm({
18997
18893
  adapter3.account.selfId = options.self_id;
18998
18894
  adapter3.adapter.communication = "http";
18999
18895
  onebot.on(OneBotEventKey.OPEN, async () => {
19000
- logger.info(`[OneBot] \u5FC3\u8DF3\u6210\u529F: ${options.url}`);
19001
- await adapter3.init();
19002
18896
  adapter3.registerBot();
19003
18897
  });
19004
18898
  onebot.on(OneBotEventKey.CLOSE, async (type) => {
@@ -19024,6 +18918,7 @@ var init_create2 = __esm({
19024
18918
  return logger.error(new Error(`${loggerPrefix} \u53D1\u751F\u9519\u8BEF:`, { cause: args.error }));
19025
18919
  });
19026
18920
  cacheMap.http.set(options.self_id, adapter3);
18921
+ await adapter3.init();
19027
18922
  return adapter3;
19028
18923
  };
19029
18924
  disconnectAllOneBotServer = () => {
@@ -26726,43 +26621,33 @@ var init_input = __esm({
26726
26621
  }
26727
26622
  async recallMsg(_, messageId) {
26728
26623
  logger.info(`[recallMsg] ${messageId}`);
26729
- return true;
26730
26624
  }
26731
26625
  async sendLike(targetId, count3) {
26732
26626
  logger.info(`[sendLike] ${targetId} ${count3}`);
26733
- return true;
26734
26627
  }
26735
26628
  async groupKickMember(groupId, targetId, rejectAddRequest, kickReason) {
26736
26629
  logger.info(`[groupKickMember] ${groupId} ${targetId} ${rejectAddRequest} ${kickReason}`);
26737
- return true;
26738
26630
  }
26739
26631
  async setGroupMute(groupId, targetId, duration) {
26740
26632
  logger.info(`[setGroupMute] ${groupId} ${targetId} ${duration}`);
26741
- return true;
26742
26633
  }
26743
26634
  async setGroupAllMute(groupId, isBan) {
26744
26635
  logger.info(`[setGroupAllMute] ${groupId} ${isBan}`);
26745
- return true;
26746
26636
  }
26747
26637
  async setGroupAdmin(groupId, targetId, isAdmin) {
26748
26638
  logger.info(`[setGroupAdmin] ${groupId} ${targetId} ${isAdmin}`);
26749
- return true;
26750
26639
  }
26751
26640
  async setGroupMemberCard(groupId, targetId, card) {
26752
26641
  logger.info(`[setGroupMemberCard] ${groupId} ${targetId} ${card}`);
26753
- return true;
26754
26642
  }
26755
26643
  async setGroupName(groupId, groupName) {
26756
26644
  logger.info(`[setGroupName] ${groupId} ${groupName}`);
26757
- return true;
26758
26645
  }
26759
26646
  async setGroupQuit(groupId, isDismiss) {
26760
26647
  logger.info(`[setGroupQuit] ${groupId} ${isDismiss}`);
26761
- return true;
26762
26648
  }
26763
26649
  async setGroupMemberTitle(groupId, targetId, title) {
26764
26650
  logger.info(`[setGroupMemberTitle] ${groupId} ${targetId} ${title}`);
26765
- return true;
26766
26651
  }
26767
26652
  async getFriendList(refresh) {
26768
26653
  logger.info(`[getFriendList] ${refresh}`);
@@ -26782,23 +26667,18 @@ var init_input = __esm({
26782
26667
  }
26783
26668
  async setFriendApplyResult(requestId, isApprove, remark) {
26784
26669
  logger.info(`[setFriendApplyResult] ${requestId} ${isApprove} ${remark}`);
26785
- return true;
26786
26670
  }
26787
26671
  async setGroupApplyResult(requestId, isApprove, denyReason) {
26788
26672
  logger.info(`[setGroupApplyResult] ${requestId} ${isApprove} ${denyReason}`);
26789
- return true;
26790
26673
  }
26791
26674
  async setInvitedJoinGroupResult(requestId, isApprove) {
26792
26675
  logger.info(`[setInvitedJoinGroupResult] ${requestId} ${isApprove}`);
26793
- return true;
26794
26676
  }
26795
26677
  async setMsgReaction(contact3, messageId, faceId, isSet) {
26796
26678
  logger.info(`[setMsgReaction] ${contact3} ${messageId} ${faceId} ${isSet}`);
26797
- return true;
26798
26679
  }
26799
26680
  async uploadFile(contact3, file2, name, folder) {
26800
26681
  logger.info(`[uploadFile] ${contact3} ${file2} ${name} ${folder}`);
26801
- return true;
26802
26682
  }
26803
26683
  };
26804
26684
  adapter2 = new AdapterConsole();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-karin",
3
- "version": "1.10.12",
3
+ "version": "1.10.14",
4
4
  "description": "Lightweight, efficient, concise, and stable robot framework.",
5
5
  "keywords": [
6
6
  "node",
package/README.md DELETED
@@ -1,95 +0,0 @@
1
- ![karin](https://socialify.git.ci/karinjs/karin/image?description=1&font=Bitter&forks=1&issues=1&language=1&logo=https%3A%2F%2Favatars.githubusercontent.com%2Fu%2F162426977%3Fs%3D200%26v%3D4&name=1&owner=1&pulls=1&stargazers=1&theme=Auto)
2
-
3
- ## 项目介绍
4
-
5
- `karin`(卡琳)是一款灵活、现代、极易扩展的 Node.js 插件化应用框架,专为开发者打造,助你轻松构建属于自己的高效工具链和自动化服务。
6
-
7
- ✨ **主要特性**:
8
- - ~~插件化架构,支持热插拔,生态丰富~~
9
- - 一行命令即可初始化项目,快速上手
10
- - 丰富的 Web UI(基于 React + HeroUI),颜值与功能并存
11
- - 支持多种自动化场景、任务调度、依赖管理
12
- - 轻松集成第三方服务,打造属于你的"数字助理"
13
- - 社区活跃,持续更新,文档完善
14
-
15
- > 🦄 让开发变得像魔法一样有趣!
16
-
17
- ## 🚀 稳定长期维护
18
-
19
- 自 `1.8.0` 版本起,Karin 已进入**稳定长期维护阶段**。我们承诺持续修复 bug、优化体验,并欢迎社区力量共同完善生态。
20
-
21
- ## 快速开始
22
-
23
- [📚 查看最新文档](https://karin.fun/)
24
-
25
- 一键初始化:`pnpm create karin`
26
-
27
- > 当前文档可能存在滞后性,欢迎加入交流群(967068507)一起玩耍、提建议!
28
-
29
- ## 温馨提示
30
-
31
- > Karin 现已稳定,放心食用!遇到问题欢迎提 Issue 或加群讨论,我们会持续优化。
32
-
33
- ## 文档站说明
34
-
35
- 我们提供多个文档站点供您访问,解决可能出现的访问困难:
36
-
37
- - **主文档站**: [https://karin.fun](https://karin.fun) (基于 GitHub Pages)
38
- - **镜像站点**:
39
- - 憨憨镜像: [https://karin.hanhanz.top](https://karin.hanhanz.top) (**推荐访问**)
40
- - Vercel 镜像: [https://docs.karin.fun](https://docs.karin.fun) (**推荐访问**)
41
- - Deno 镜像: [https://karin.deno.dev](https://karin.deno.dev) (**推荐访问**)
42
-
43
- > 💡 主文档站托管在 GitHub 上,如访问不畅,推荐使用 Deno 镜像站
44
-
45
- ## 鸣谢
46
-
47
- - webui: [bietiaop](https://github.com/bietiaop)
48
- - docs: [ikenxuan](https://github.com/ikenxuan)
49
- - name: [fuqiuluo](https://github.com/fuqiuluo)
50
-
51
- > 🧙‍♂️ 感谢三位大佬的魔法加持!
52
-
53
- ### 贡献者
54
-
55
- > 🌟 星光闪烁,你们的智慧如同璀璨的夜空。感谢所有为 **Karin** 做出贡献的人!
56
-
57
- [![贡献者](https://contributors-img.web.app/image?repo=KarinJS/Karin)](https://github.com/KarinJS/Karin/graphs/contributors)
58
-
59
- ![Alt](https://repobeats.axiom.co/api/embed/aaaa2759c8885691443a4d80e5753f975d4f250e.svg "Repobeats analytics image")
60
-
61
- ---
62
-
63
- 🎉 **加入我们,让 Karin 成为你开发路上的贴心伙伴!**
64
-
65
- ## 常见问题
66
-
67
- - 文档没看懂?[点我提问](https://github.com/KarinJS/Karin/issues) 或加群 967068507
68
- - 插件不会写?欢迎参考[插件开发文档](https://karin.fun/plugins/)
69
- - 遇到 bug?大胆提 Issue,我们超快响应!
70
-
71
- ## 如何参与贡献(PR)
72
-
73
- 1. Fork 本仓库,创建你的分支
74
- 2. 提交你的更改,附上简要说明
75
- 3. 发起 Pull Request,耐心等待 Review
76
- 4. 你的名字将出现在贡献者列表,收获一份开源荣誉!
77
-
78
- > 💡 欢迎任何形式的贡献,无论是代码、文档、建议还是灵感!
79
-
80
- ## Issue 指南
81
-
82
- - 提交前请先搜索是否有类似问题
83
- - 尽量提供详细的复现步骤、环境信息和截图
84
- - 标题简明扼要,正文描述清晰
85
- - 遇到安全相关问题请私信维护者
86
-
87
- ## 开源协议
88
-
89
- 本项目基于 [MIT License](./LICENSE) 开源,欢迎自由使用、修改和分发。
90
-
91
- > 📢 记得给个 Star 支持我们,你的支持是我们最大的动力!
92
-
93
- ## 更新日志
94
-
95
- 我们定期发布更新,查看 [CHANGELOG](https://github.com/KarinJS/Karin/releases) 了解最新变化。