ErisPulse-OneBot11Adapter 4.0.1__tar.gz → 4.1.0__tar.gz

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 (15) hide show
  1. {erispulse_onebot11adapter-4.0.1 → erispulse_onebot11adapter-4.1.0}/ErisPulse_OneBot11Adapter.egg-info/PKG-INFO +1 -1
  2. {erispulse_onebot11adapter-4.0.1 → erispulse_onebot11adapter-4.1.0}/OneBotAdapter/Core.py +284 -0
  3. {erispulse_onebot11adapter-4.0.1 → erispulse_onebot11adapter-4.1.0}/PKG-INFO +1 -1
  4. {erispulse_onebot11adapter-4.0.1 → erispulse_onebot11adapter-4.1.0}/pyproject.toml +1 -1
  5. {erispulse_onebot11adapter-4.0.1 → erispulse_onebot11adapter-4.1.0}/ErisPulse_OneBot11Adapter.egg-info/SOURCES.txt +0 -0
  6. {erispulse_onebot11adapter-4.0.1 → erispulse_onebot11adapter-4.1.0}/ErisPulse_OneBot11Adapter.egg-info/dependency_links.txt +0 -0
  7. {erispulse_onebot11adapter-4.0.1 → erispulse_onebot11adapter-4.1.0}/ErisPulse_OneBot11Adapter.egg-info/entry_points.txt +0 -0
  8. {erispulse_onebot11adapter-4.0.1 → erispulse_onebot11adapter-4.1.0}/ErisPulse_OneBot11Adapter.egg-info/requires.txt +0 -0
  9. {erispulse_onebot11adapter-4.0.1 → erispulse_onebot11adapter-4.1.0}/ErisPulse_OneBot11Adapter.egg-info/top_level.txt +0 -0
  10. {erispulse_onebot11adapter-4.0.1 → erispulse_onebot11adapter-4.1.0}/LICENSE +0 -0
  11. {erispulse_onebot11adapter-4.0.1 → erispulse_onebot11adapter-4.1.0}/OneBotAdapter/Converter.py +0 -0
  12. {erispulse_onebot11adapter-4.0.1 → erispulse_onebot11adapter-4.1.0}/OneBotAdapter/__init__.py +0 -0
  13. {erispulse_onebot11adapter-4.0.1 → erispulse_onebot11adapter-4.1.0}/README.md +0 -0
  14. {erispulse_onebot11adapter-4.0.1 → erispulse_onebot11adapter-4.1.0}/setup.cfg +0 -0
  15. {erispulse_onebot11adapter-4.0.1 → erispulse_onebot11adapter-4.1.0}/test/test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ErisPulse-OneBot11Adapter
3
- Version: 4.0.1
3
+ Version: 4.1.0
4
4
  Summary: ErisPulse的OneBotV11协议适配模块,异步的OneBot触发器
5
5
  Author-email: wsu2059q <wsu2059@qq.com>
6
6
  License: MIT License
@@ -286,6 +286,290 @@ class OneBotAdapter(BaseAdapter):
286
286
  )
287
287
  )
288
288
 
289
+ def Like(self, user_id: Union[str, int], times: int = 1):
290
+ """
291
+ 发送好友赞
292
+
293
+ :param user_id: [Union[str, int]] 目标用户 ID
294
+ :param times: [int] 点赞次数(默认 1 次,最大 10 次)
295
+ :return: [asyncio.Task] 点赞任务
296
+ """
297
+ return asyncio.create_task(
298
+ self._adapter.call_api(
299
+ endpoint="send_like",
300
+ user_id=int(user_id),
301
+ times=times,
302
+ )
303
+ )
304
+
305
+ def Kick(self, user_id: Union[str, int], reject_add_request: bool = False):
306
+ """
307
+ 群组踢人(需通过 To("group", group_id) 指定群)
308
+
309
+ :param user_id: [Union[str, int]] 要踢的用户 ID
310
+ :param reject_add_request: [bool] 是否拒绝此人再加群(默认 False)
311
+ :return: [asyncio.Task] 踢人任务
312
+ """
313
+ ctx = self.send_context
314
+ return asyncio.create_task(
315
+ self._adapter.call_api(
316
+ endpoint="set_group_kick",
317
+ group_id=int(ctx.get("target_id", 0)),
318
+ user_id=int(user_id),
319
+ reject_add_request=reject_add_request,
320
+ account_id=ctx.get("account_id"),
321
+ )
322
+ )
323
+
324
+ def Ban(self, user_id: Union[str, int], duration: int = 1800):
325
+ """
326
+ 群组单人禁言(需通过 To("group", group_id) 指定群)
327
+
328
+ :param user_id: [Union[str, int]] 要禁言的用户 ID
329
+ :param duration: [int] 禁言时长(秒),默认 1800(30分钟),0 表示解禁
330
+ :return: [asyncio.Task] 禁言任务
331
+ """
332
+ ctx = self.send_context
333
+ return asyncio.create_task(
334
+ self._adapter.call_api(
335
+ endpoint="set_group_ban",
336
+ group_id=int(ctx.get("target_id", 0)),
337
+ user_id=int(user_id),
338
+ duration=duration,
339
+ account_id=ctx.get("account_id"),
340
+ )
341
+ )
342
+
343
+ def WholeBan(self, enable: bool = True):
344
+ """
345
+ 群组全员禁言(需通过 To("group", group_id) 指定群)
346
+
347
+ :param enable: [bool] 是否开启全员禁言(默认 True)
348
+ :return: [asyncio.Task] 禁言任务
349
+ """
350
+ ctx = self.send_context
351
+ return asyncio.create_task(
352
+ self._adapter.call_api(
353
+ endpoint="set_group_whole_ban",
354
+ group_id=int(ctx.get("target_id", 0)),
355
+ enable=enable,
356
+ account_id=ctx.get("account_id"),
357
+ )
358
+ )
359
+
360
+ def SetAdmin(self, user_id: Union[str, int], enable: bool = True):
361
+ """
362
+ 设置/取消群管理员(需通过 To("group", group_id) 指定群)
363
+
364
+ :param user_id: [Union[str, int]] 要设置的用户 ID
365
+ :param enable: [bool] True 设为管理员,False 取消(默认 True)
366
+ :return: [asyncio.Task] 设置任务
367
+ """
368
+ ctx = self.send_context
369
+ return asyncio.create_task(
370
+ self._adapter.call_api(
371
+ endpoint="set_group_admin",
372
+ group_id=int(ctx.get("target_id", 0)),
373
+ user_id=int(user_id),
374
+ enable=enable,
375
+ account_id=ctx.get("account_id"),
376
+ )
377
+ )
378
+
379
+ def SetCard(self, user_id: Union[str, int], card: str = ""):
380
+ """
381
+ 设置群名片(需通过 To("group", group_id) 指定群)
382
+
383
+ :param user_id: [Union[str, int]] 要设置的用户 ID
384
+ :param card: [str] 群名片内容,空字符串表示清空
385
+ :return: [asyncio.Task] 设置任务
386
+ """
387
+ ctx = self.send_context
388
+ return asyncio.create_task(
389
+ self._adapter.call_api(
390
+ endpoint="set_group_card",
391
+ group_id=int(ctx.get("target_id", 0)),
392
+ user_id=int(user_id),
393
+ card=card,
394
+ account_id=ctx.get("account_id"),
395
+ )
396
+ )
397
+
398
+ def SetGroupName(self, name: str):
399
+ """
400
+ 设置群名(需通过 To("group", group_id) 指定群)
401
+
402
+ :param name: [str] 新的群名称
403
+ :return: [asyncio.Task] 设置任务
404
+ """
405
+ ctx = self.send_context
406
+ return asyncio.create_task(
407
+ self._adapter.call_api(
408
+ endpoint="set_group_name",
409
+ group_id=int(ctx.get("target_id", 0)),
410
+ group_name=name,
411
+ account_id=ctx.get("account_id"),
412
+ )
413
+ )
414
+
415
+ def Leave(self, is_dismiss: bool = False):
416
+ """
417
+ 退群(需通过 To("group", group_id) 指定群)
418
+
419
+ :param is_dismiss: [bool] 是否解散群(仅群主可用,默认 False)
420
+ :return: [asyncio.Task] 退群任务
421
+ """
422
+ ctx = self.send_context
423
+ return asyncio.create_task(
424
+ self._adapter.call_api(
425
+ endpoint="set_group_leave",
426
+ group_id=int(ctx.get("target_id", 0)),
427
+ is_dismiss=is_dismiss,
428
+ account_id=ctx.get("account_id"),
429
+ )
430
+ )
431
+
432
+ def SetTitle(self, user_id: Union[str, int], title: str = ""):
433
+ """
434
+ 设置群头衔(需通过 To("group", group_id) 指定群)
435
+
436
+ :param user_id: [Union[str, int]] 要设置的用户 ID
437
+ :param title: [str] 头衔内容,空字符串表示清空
438
+ :return: [asyncio.Task] 设置任务
439
+ """
440
+ ctx = self.send_context
441
+ return asyncio.create_task(
442
+ self._adapter.call_api(
443
+ endpoint="set_group_special_title",
444
+ group_id=int(ctx.get("target_id", 0)),
445
+ user_id=int(user_id),
446
+ special_title=title,
447
+ account_id=ctx.get("account_id"),
448
+ )
449
+ )
450
+
451
+ def SetPortrait(self, file: Union[str, bytes]):
452
+ """
453
+ 设置群头像(需通过 To("group", group_id) 指定群)
454
+
455
+ :param file: [Union[str, bytes]] 图片文件(URL 或 bytes)
456
+ :return: [asyncio.Task] 设置任务
457
+ """
458
+ ctx = self.send_context
459
+ return asyncio.create_task(
460
+ self._adapter.call_api(
461
+ endpoint="set_group_portrait",
462
+ group_id=int(ctx.get("target_id", 0)),
463
+ file=file,
464
+ account_id=ctx.get("account_id"),
465
+ )
466
+ )
467
+
468
+ def GetMsg(self, message_id: Union[str, int]):
469
+ """
470
+ 获取消息内容
471
+
472
+ :param message_id: [Union[str, int]] 消息 ID
473
+ :return: [asyncio.Task] 获取任务
474
+ """
475
+ return asyncio.create_task(
476
+ self._adapter.call_api(
477
+ endpoint="get_msg",
478
+ message_id=int(message_id),
479
+ )
480
+ )
481
+
482
+ def GetForwardMsg(self, id: Union[str, int]):
483
+ """
484
+ 获取合并转发消息内容
485
+
486
+ :param id: [Union[str, int]] 合并转发 ID
487
+ :return: [asyncio.Task] 获取任务
488
+ """
489
+ return asyncio.create_task(
490
+ self._adapter.call_api(
491
+ endpoint="get_forward_msg",
492
+ id=str(id),
493
+ )
494
+ )
495
+
496
+ def GetLoginInfo(self):
497
+ """
498
+ 获取登录号信息
499
+
500
+ :return: [asyncio.Task] 获取任务(包含 user_id、nickname)
501
+ """
502
+ return asyncio.create_task(
503
+ self._adapter.call_api(endpoint="get_login_info")
504
+ )
505
+
506
+ def GetFriendList(self):
507
+ """
508
+ 获取好友列表
509
+
510
+ :return: [asyncio.Task] 获取任务
511
+ """
512
+ return asyncio.create_task(
513
+ self._adapter.call_api(endpoint="get_friend_list")
514
+ )
515
+
516
+ def GetGroupInfo(self):
517
+ """
518
+ 获取群信息(需通过 To("group", group_id) 指定群)
519
+
520
+ :return: [asyncio.Task] 获取任务
521
+ """
522
+ ctx = self.send_context
523
+ return asyncio.create_task(
524
+ self._adapter.call_api(
525
+ endpoint="get_group_info",
526
+ group_id=int(ctx.get("target_id", 0)),
527
+ account_id=ctx.get("account_id"),
528
+ )
529
+ )
530
+
531
+ def GetGroupList(self):
532
+ """
533
+ 获取群列表
534
+
535
+ :return: [asyncio.Task] 获取任务
536
+ """
537
+ return asyncio.create_task(
538
+ self._adapter.call_api(endpoint="get_group_list")
539
+ )
540
+
541
+ def GetGroupMemberInfo(self, user_id: Union[str, int]):
542
+ """
543
+ 获取群成员信息(需通过 To("group", group_id) 指定群)
544
+
545
+ :param user_id: [Union[str, int]] 用户 ID
546
+ :return: [asyncio.Task] 获取任务
547
+ """
548
+ ctx = self.send_context
549
+ return asyncio.create_task(
550
+ self._adapter.call_api(
551
+ endpoint="get_group_member_info",
552
+ group_id=int(ctx.get("target_id", 0)),
553
+ user_id=int(user_id),
554
+ account_id=ctx.get("account_id"),
555
+ )
556
+ )
557
+
558
+ def GetGroupMemberList(self):
559
+ """
560
+ 获取群成员列表(需通过 To("group", group_id) 指定群)
561
+
562
+ :return: [asyncio.Task] 获取任务
563
+ """
564
+ ctx = self.send_context
565
+ return asyncio.create_task(
566
+ self._adapter.call_api(
567
+ endpoint="get_group_member_list",
568
+ group_id=int(ctx.get("target_id", 0)),
569
+ account_id=ctx.get("account_id"),
570
+ )
571
+ )
572
+
289
573
  def _convert_ob12_to_ob11(self, message: List[Dict]) -> List[Dict]:
290
574
  """
291
575
  将 OB12 消息段转换为 OB11 格式
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ErisPulse-OneBot11Adapter
3
- Version: 4.0.1
3
+ Version: 4.1.0
4
4
  Summary: ErisPulse的OneBotV11协议适配模块,异步的OneBot触发器
5
5
  Author-email: wsu2059q <wsu2059@qq.com>
6
6
  License: MIT License
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ErisPulse-OneBot11Adapter"
3
- version = "4.0.1"
3
+ version = "4.1.0"
4
4
  description = "ErisPulse的OneBotV11协议适配模块,异步的OneBot触发器"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"