nonebot-plugin-l4d2-server 1.0.4__tar.gz → 1.0.5__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 (98) hide show
  1. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/PKG-INFO +3 -3
  2. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/__main__.py +11 -24
  3. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/config.py +1 -1
  4. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/Help.json +2 -39
  5. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/__init__.py +5 -7
  6. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/html_img.py +1 -1
  7. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_local/__init__.py +0 -1
  8. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_request/__init__.py +17 -165
  9. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_request/draw_msg.py +1 -1
  10. nonebot_plugin_l4d2_server-1.0.5/nonebot_plugin_l4d2_server/l4_request/utils.py +176 -0
  11. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/utils/api/request.py +42 -27
  12. nonebot_plugin_l4d2_server-1.0.5/nonebot_plugin_l4d2_server/utils/api/utils.py +30 -0
  13. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/pyproject.toml +3 -3
  14. nonebot_plugin_l4d2_server-1.0.4/nonebot_plugin_l4d2_server/l4_request/utils.py +0 -0
  15. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/LICENSE +0 -0
  16. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/README.md +0 -0
  17. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/__init__.py +0 -0
  18. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/data/font/loli.ttf +0 -0
  19. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/draw.py +0 -0
  20. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//344/273/213/347/273/215.png" +0 -0
  21. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//344/273/273/345/212/241.png" +0 -0
  22. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//344/277/241/346/201/257.png" +0 -0
  23. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//345/205/254/345/221/212.png" +0 -0
  24. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//345/210/200/345/211/221.png" +0 -0
  25. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//345/210/207/346/215/242.png" +0 -0
  26. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//345/210/240/351/231/244.png" +0 -0
  27. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//345/210/267/346/226/260.png" +0 -0
  28. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//345/215/241/347/273/204.png" +0 -0
  29. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//345/223/252/351/207/214.png" +0 -0
  30. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//345/234/260/345/233/276.png" +0 -0
  31. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//345/257/274/345/205/245.png" +0 -0
  32. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//345/257/274/345/207/272.png" +0 -0
  33. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//345/275/261.png" +0 -0
  34. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//346/213/274/345/233/276.png" +0 -0
  35. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//346/216/242/347/264/242.png" +0 -0
  36. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//346/216/250/351/200/201.png" +0 -0
  37. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//346/224/266/351/233/206.png" +0 -0
  38. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//346/224/273/347/225/245.png" +0 -0
  39. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//346/233/264/346/226/260.png" +0 -0
  40. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//346/235/220/346/226/231.png" +0 -0
  41. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//346/237/245/350/257/242.png" +0 -0
  42. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//346/240/241/351/252/214.png" +0 -0
  43. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//346/257/217/346/234/210.png" +0 -0
  44. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//346/267/261/346/270/212.png" +0 -0
  45. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//346/267/273/345/212/240.png" +0 -0
  46. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//346/270/205/351/231/244.png" +0 -0
  47. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//347/212/266/346/200/201.png" +0 -0
  48. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//347/255/276/345/210/260.png" +0 -0
  49. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//347/273/221/345/256/232.png" +0 -0
  50. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//350/241/250.png" +0 -0
  51. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//350/241/250/346/203/205.png" +0 -0
  52. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//350/247/222/350/211/262.png" +0 -0
  53. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//350/256/260/345/275/225.png" +0 -0
  54. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//351/205/215/347/275/256.png" +0 -0
  55. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/icon//351/207/215/345/220/257.png" +0 -0
  56. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/texture2d/badge.png +0 -0
  57. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/texture2d/banner.png +0 -0
  58. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/texture2d/bg.jpg +0 -0
  59. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/texture2d/button.png +0 -0
  60. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_help/texture2d/icon.png +0 -0
  61. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/__init__.py +0 -0
  62. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/anne_pil.py +0 -0
  63. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/convert.py +0 -0
  64. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/download.py +0 -0
  65. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/image_tools.py +0 -0
  66. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/anne/anne.html +0 -0
  67. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/anne/back.png +0 -0
  68. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/anne/back1.jpg +0 -0
  69. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/anne/group_ip.html +0 -0
  70. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/anne/ip.html +0 -0
  71. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/head/head.png +0 -0
  72. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/header/logo.png +0 -0
  73. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/header/player1.jpg +0 -0
  74. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/template/Bocchi_The_Rock.html +0 -0
  75. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/template/Bocchi_The_Rock.png +0 -0
  76. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/template/HYPixel11pxU-2.ttf +0 -0
  77. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/template/Pixel.html +0 -0
  78. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/template/Pixel.png +0 -0
  79. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/template/Rainbow.html +0 -0
  80. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/template/Rainbow.png +0 -0
  81. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/template/Tutumianhuatang-Bold-2.ttf +0 -0
  82. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/template/bilibili.svg +0 -0
  83. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/template/fingerprint.svg +0 -0
  84. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/template/github.svg +0 -0
  85. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/template/l.svg +0 -0
  86. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/template/m.svg +0 -0
  87. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/template/normal.html +0 -0
  88. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/template/vac.png +0 -0
  89. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/template/vac_white.png +0 -0
  90. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/template/vue.css +0 -0
  91. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/img/template/w.svg +0 -0
  92. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/model.py +0 -0
  93. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_image/vtfs.py +0 -0
  94. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/l4_local/file.py +0 -0
  95. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/utils/api/api.py +0 -0
  96. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/utils/api/models.py +0 -0
  97. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/utils/database/models.py +0 -0
  98. {nonebot_plugin_l4d2_server-1.0.4 → nonebot_plugin_l4d2_server-1.0.5}/nonebot_plugin_l4d2_server/utils/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nonebot-plugin-l4d2-server
3
- Version: 1.0.4
3
+ Version: 1.0.5
4
4
  Summary: L4D2 server related operations plugin for NoneBot2
5
5
  Keywords: steam,game,l4d2,nonebot2,plugin
6
6
  Author-Email: Agnes_Digital <Z735803792@163.com>
@@ -25,13 +25,13 @@ Requires-Dist: nonebot-plugin-tortoise-orm>=0.1.4
25
25
  Requires-Dist: aiohttp>=3.8.4
26
26
  Requires-Dist: jinja2>=3.0.0
27
27
  Requires-Dist: srctools>=2.3.9
28
- Requires-Dist: httpx<0.24.1,>=0.22.0
28
+ Requires-Dist: httpx>=0.22.0
29
29
  Requires-Dist: msgspec>=0.18.0
30
30
  Requires-Dist: python-a2s>=1.4.1
31
31
  Requires-Dist: ujson>=5.10.0
32
32
  Requires-Dist: lxml>=5.2.2
33
33
  Requires-Dist: rcon>=2.1.0
34
- Requires-Dist: pillow>10
34
+ Requires-Dist: pillow>10.0.0
35
35
  Requires-Dist: bs4>=0.0.2
36
36
  Requires-Dist: rarfile>=4.2
37
37
  Requires-Dist: pyunpack>=0.3
@@ -16,7 +16,7 @@
16
16
  """
17
17
 
18
18
  from pathlib import Path
19
- from typing import TYPE_CHECKING, List, Optional, Union
19
+ from typing import TYPE_CHECKING, List, Optional
20
20
 
21
21
  import aiofiles
22
22
  import ujson as json
@@ -40,6 +40,7 @@ from .l4_request import (
40
40
  tj_request,
41
41
  )
42
42
  from .utils.api.request import L4API
43
+ from .utils.api.utils import out_msg_out
43
44
 
44
45
  if TYPE_CHECKING:
45
46
  from .utils.api.models import OutServer
@@ -111,10 +112,15 @@ async def _(
111
112
  _id = None
112
113
  logger.info(f"组:{command} ;数字:{_id}")
113
114
  msg = await get_server_detail(command, _id)
114
- if msg is not None:
115
- await out_msg_out(msg, is_connect=config.l4_image)
116
- else:
115
+ if msg is None:
117
116
  await out_msg_out("服务器无响应")
117
+ return
118
+ if _id is None:
119
+ logger.info(f"正在输出组:{command}")
120
+ await out_msg_out(msg)
121
+ if _id:
122
+ logger.info(f"正在输出单服务器:{command} {_id}", is_connect=config.l4_image)
123
+ await out_msg_out(msg)
118
124
 
119
125
 
120
126
  @l4_find_player.handle()
@@ -161,11 +167,10 @@ async def _(args: Message = CommandArg()):
161
167
  @l4_reload.handle()
162
168
  async def _(args: Message = CommandArg()):
163
169
  arg = args.extract_plain_text().strip()
164
- print(arg)
165
170
  if not arg:
166
171
  reload_ip()
167
172
  logger.success("重载ip完成")
168
- with (Path(config.l4_path) / "config.json").open("r", encoding="utf-8") as f:
173
+ with (Path(config.l4_path) / "l4d2.json").open("r", encoding="utf-8") as f:
169
174
  content = f.read().strip()
170
175
  ip_json = json.loads(content)
171
176
  for tag, url in ip_json.items():
@@ -261,24 +266,6 @@ async def _(matcher: Matcher):
261
266
  await matcher.finish(await tj_request("云", "zl"))
262
267
 
263
268
 
264
- async def out_msg_out(
265
- msg: Union[str, bytes, UniMessage],
266
- is_connect: bool = False,
267
- host: str = "",
268
- port: str = "",
269
- ):
270
- if isinstance(msg, UniMessage):
271
- return await msg.finish()
272
- if isinstance(msg, str):
273
- await UniMessage.text(msg).finish()
274
- if is_connect:
275
- out = UniMessage.image(raw=msg) + UniMessage.text(
276
- f"连接到服务器: {host}:{port}",
277
- )
278
- return await out.finish()
279
- return await UniMessage.image(raw=msg).finish()
280
-
281
-
282
269
  ## 以下为配置修改
283
270
 
284
271
  img_trung = on_command("l4img", aliases={"l4图片"}, permission=SUPERUSER)
@@ -6,10 +6,10 @@ from pydantic import BaseModel
6
6
 
7
7
  DATAPATH = Path(__file__).parent.joinpath("data")
8
8
  DATAOUT = Path("data/L4D2")
9
+ DATAOUT.mkdir(parents=True, exist_ok=True)
9
10
  if not Path(DATAOUT / "l4d2.json").exists():
10
11
  logger.info("文件 l4d2.json 不存在,已创建并初始化为 {}")
11
12
  Path(DATAOUT / "l4d2.json").write_text("{}", encoding="utf-8")
12
- print(DATAOUT.absolute())
13
13
  server_all_path = DATAOUT / "l4d2"
14
14
  server_all_path.mkdir(parents=True, exist_ok=True)
15
15
 
@@ -28,7 +28,7 @@
28
28
  },
29
29
  {
30
30
  "name": "l4全服",
31
- "desc": "返回可以查询的所有服务器组(未完成)",
31
+ "desc": "返回可以查询的所有服务器组",
32
32
  "eg": "/l4全服",
33
33
  "need_ck": false,
34
34
  "need_sk": false,
@@ -36,43 +36,6 @@
36
36
  }
37
37
  ]
38
38
  },
39
- "电信服anne服务": {
40
- "desc": "电信anne服相关服务",
41
- "data": [
42
- {
43
- "name": "Banne xx",
44
- "desc": "绑定昵称/steamid",
45
- "eg": "/Banne 爱丽数码",
46
- "need_ck": false,
47
- "need_sk": false,
48
- "need_admin": false
49
- },
50
- {
51
- "name": "Ranne(玩家)",
52
- "desc": "查询anne个人信息,没有参数查自己",
53
- "eg": "/Ranne 爱丽数码",
54
- "need_ck": false,
55
- "need_sk": false,
56
- "need_admin": false
57
- },
58
- {
59
- "name": "Sanne(玩家)",
60
- "desc": "按昵称查询anne玩家信息",
61
- "eg": "/Sanne 爱丽数码",
62
- "need_ck": false,
63
- "need_sk": false,
64
- "need_admin": false
65
- },
66
- {
67
- "name": "Danne(玩家)",
68
- "desc": "删除anne玩家信息",
69
- "eg": "/Danne 爱丽数码",
70
- "need_ck": false,
71
- "need_sk": false,
72
- "need_admin": false
73
- }
74
- ]
75
- },
76
39
  "管理员服务": {
77
40
  "desc": "管理可以使用的指令",
78
41
  "data": [
@@ -83,7 +46,7 @@
83
46
  "need_ck": false,
84
47
  "need_sk": false,
85
48
  "need_admin": true
86
- },
49
+ },
87
50
  {
88
51
  "name": "l4地图上传",
89
52
  "desc": "进入交互上传地图文件",
@@ -1,8 +1,8 @@
1
+ import json
1
2
  from pathlib import Path
2
3
  from typing import Dict, Union
3
4
 
4
5
  import aiofiles
5
- from msgspec import json as msgjson
6
6
  from PIL import Image
7
7
 
8
8
  from ..config import ICONPATH
@@ -10,18 +10,16 @@ from ..l4_image.convert import core_font
10
10
  from ..l4_image.model import PluginHelp
11
11
  from .draw import get_help
12
12
 
13
- __version__ = "1.0.4"
13
+ __version__ = "1.0.5"
14
14
  TEXT_PATH = Path(__file__).parent / "texture2d"
15
15
  HELP_DATA = Path(__file__).parent / "Help.json"
16
16
 
17
17
 
18
18
  async def get_help_data() -> Union[Dict[str, PluginHelp], None]:
19
19
  if HELP_DATA.exists():
20
- async with aiofiles.open(HELP_DATA, "rb") as file:
21
- return msgjson.decode(
22
- await file.read(),
23
- type=Dict[str, PluginHelp],
24
- )
20
+ async with aiofiles.open(HELP_DATA, "r", encoding="utf-8") as file:
21
+ content = await file.read()
22
+ return json.loads(content)
25
23
  return None
26
24
 
27
25
 
@@ -45,7 +45,7 @@ async def server_ip_pic(server_dict: List[OutServer]):
45
45
  key=lambda x: x.score,
46
46
  reverse=True,
47
47
  )[:max_number]
48
- print(sorted_players)
48
+ logger.debug(sorted_players)
49
49
  server_info["player"] = sorted_players
50
50
  else:
51
51
  server_info["player"] = []
@@ -47,7 +47,6 @@ else:
47
47
  async def _():
48
48
  supath = local_path[map_index] / "addons"
49
49
  vpk_list: list[str] = []
50
- print(supath)
51
50
  if supath.is_dir():
52
51
  for sudir in supath.iterdir():
53
52
  logger.info(f"找到文件:{sudir}")
@@ -1,22 +1,29 @@
1
1
  import random
2
- from typing import Dict, List, Optional, Tuple, Union, cast
2
+ from typing import Dict, List, Optional, cast
3
3
 
4
4
  from nonebot.log import logger
5
5
  from nonebot_plugin_alconna import UniMessage
6
6
 
7
- from ..config import server_all_path
8
- from ..l4_image import msg_to_image
7
+ from ..config import config, server_all_path
9
8
  from ..utils.api.models import AllServer, NserverOut
10
9
  from ..utils.api.request import L4API
11
10
  from ..utils.utils import split_maohao
12
- from .draw_msg import convert_duration, draw_one_ip, get_much_server
11
+ from .draw_msg import draw_one_ip, get_much_server
12
+ from .utils import (
13
+ _build_message,
14
+ _filter_servers,
15
+ _format_players,
16
+ _get_server_json,
17
+ _handle_group_info,
18
+ _handle_single_server,
19
+ get_single_server_info,
20
+ )
13
21
 
14
22
  try:
15
23
  import ujson as json
16
24
  except ImportError:
17
25
  import json
18
26
 
19
- from ..config import config
20
27
 
21
28
  # 获取全部服务器信息
22
29
  ALLHOST: Dict[str, List[NserverOut]] = {}
@@ -88,12 +95,13 @@ async def get_server_detail(
88
95
  否则返回服务器详细信息(图片格式返回bytes,文本格式返回str);
89
96
  未找到服务器组返回None。
90
97
  """
91
- server_json = _get_server_json(command)
98
+ server_json = _get_server_json(command, ALLHOST)
92
99
  logger.info(server_json)
93
100
  if server_json is None:
94
101
  logger.warning("未找到这个组")
95
102
  return None
96
103
 
104
+ # 输出组服务器
97
105
  if _id is None:
98
106
  return await _handle_group_info(server_json, command, is_img)
99
107
 
@@ -112,99 +120,10 @@ async def get_server_detail(
112
120
  return None
113
121
 
114
122
 
115
- def _get_server_json(command: str) -> Optional[list]:
116
- """
117
- 根据命令获取服务器JSON列表
118
-
119
- Args:
120
- command (str): 服务器组名
121
-
122
- Returns:
123
- Optional[list]: 服务器JSON列表,未找到组时返回None
124
- """
125
- if command:
126
- return ALLHOST.get(command)
127
- server_json = []
128
- for servers in ALLHOST.values():
129
- server_json.extend(servers)
130
- return server_json
131
-
132
-
133
- async def _handle_group_info(
134
- server_json: list,
135
- command: str,
136
- is_img: bool,
137
- ) -> Union[bytes, str, None]:
138
- """
139
- 处理服务器组信息请求
140
-
141
- Args:
142
- server_json (list): 服务器JSON列表
143
- command (str): 服务器组名
144
- is_img (bool): 是否返回图片格式
145
-
146
- Returns:
147
- Union[bytes, list, None]: 图片格式返回bytes,否则返回服务器列表
148
- """
149
- logger.info(f"正在请求组服务器信息 {command}")
150
- server_dict = await get_much_server(server_json, command)
151
- if is_img:
152
- return await msg_to_image(server_dict)
153
- return str(server_dict)
154
-
155
-
156
- async def get_single_server_info(
157
- server_json: list,
158
- _id: str,
159
- ) -> Optional[Tuple[str, int]]:
160
- """
161
- 获取单个服务器的host和port信息
162
-
163
- Args:
164
- server_json (list): 服务器JSON列表
165
- _id (str): 服务器ID
166
-
167
- Returns:
168
- Optional[Tuple[str, int]]: 返回(host, port)元组,未找到返回None
169
- """
170
- logger.info("正在获取单服务器信息")
171
- for i in server_json:
172
- if str(_id) == str(i["id"]):
173
- return i["host"], i["port"]
174
- return None
175
-
176
-
177
- async def _handle_single_server(
178
- server_json: list,
179
- _id: str,
180
- is_img: bool,
181
- ) -> Union[bytes, str, None]:
182
- """
183
- 处理单个服务器信息请求
184
-
185
- Args:
186
- server_json (list): 服务器JSON列表
187
- _id (str): 服务器ID
188
- is_img (bool): 是否返回图片格式
189
-
190
- Returns:
191
- Union[bytes, str, None]: 找到服务器时返回信息,否则返回None
192
- """
193
- server_info = await get_single_server_info(server_json, _id)
194
- if server_info is None:
195
- return None
196
-
197
- host, port = server_info
198
- out_msg = await draw_one_ip(host, port)
199
- if is_img:
200
- return cast(bytes, out_msg)
201
- return out_msg
202
-
203
-
204
123
  async def get_group_detail(
205
124
  command: str,
206
125
  ):
207
- server_json = ALLHOST.get(command)
126
+ server_json = _get_server_json(command, ALLHOST)
208
127
  logger.info(server_json)
209
128
  if server_json is None:
210
129
  logger.warning("未找到这个组")
@@ -222,7 +141,6 @@ async def get_ip_server(ip: str):
222
141
  # 以下是重载ip
223
142
  def reload_ip():
224
143
  global COMMAND
225
- # print("正在读取json文件")
226
144
  group_ip = []
227
145
  for item in server_all_path.iterdir():
228
146
  if item.is_file() and item.name.endswith("json"):
@@ -266,74 +184,8 @@ async def tj_request(command: str = "云", tj="tj"):
266
184
  player_msg = ""
267
185
  right_ip = []
268
186
 
269
- async def _filter_servers(servers: list, tj_mode: str) -> list:
270
- """筛选符合条件的服务器
271
- Args:
272
- servers: 服务器列表
273
- tj_mode: 筛选模式('tj'或'zl')
274
- Returns:
275
- 符合条件的服务器列表
276
- """
277
- filtered = []
278
- for i in servers:
279
- ser_list = await L4API.a2s_info([(i["host"], i["port"])], is_player=True)
280
- if not ser_list:
281
- continue
282
-
283
- srv = ser_list[0][0]
284
- players = ser_list[0][1]
285
-
286
- if tj_mode == "tj" and map_type in srv.map_name:
287
- score = sum(p.score for p in players[:4])
288
- t = srv.map_name.split("[")[-1].split("特")[0]
289
- if t.isdigit() and int(t) * 50 < score:
290
- logger.info(
291
- f"符合TJ条件的服务器: {i['host']}:{i['port']}, 地图: {srv.map_name}, 分数: {score}",
292
- )
293
- filtered.append(i)
294
- elif tj_mode == "zl" and map_type in srv.map_name and len(players) <= 4:
295
- logger.info(
296
- f"符合ZL条件的服务器: {i['host']}:{i['port']}, 地图: {srv.map_name}, 玩家数: {len(players)}",
297
- )
298
- filtered.append(i)
299
- return filtered
300
-
301
- async def _format_players(player_list: list) -> str:
302
- """格式化玩家信息
303
- Args:
304
- player_list: 玩家对象列表
305
- Returns:
306
- 格式化后的玩家信息字符串
307
- """
308
- durations = [await convert_duration(p.duration) for p in player_list]
309
- max_duration_len = max(len(str(d)) for d in durations)
310
- max_score_len = max(len(str(p.score)) for p in player_list)
311
- return "\n".join(
312
- f"[{p.score:>{max_score_len}}] | {durations[i]:^{max_duration_len}} | {p.name[0]}***{p.name[-1]}"
313
- for i, p in enumerate(player_list)
314
- )
315
-
316
- def _build_message(srv_info, players_msg: str, selected_srv: dict) -> str:
317
- """构建服务器信息消息
318
- Args:
319
- srv_info: 服务器信息对象
320
- players_msg: 格式化后的玩家信息
321
- selected_srv: 选中的服务器信息
322
- Returns:
323
- 完整的消息字符串
324
- """
325
- msg = f"""*{srv_info.server_name}*
326
- 游戏: {srv_info.folder}
327
- 地图: {srv_info.map_name}
328
- 人数: {srv_info.player_count}/{srv_info.max_players}"""
329
- if srv_info.ping is not None:
330
- msg += f"\nping: {srv_info.ping * 1000:.0f}ms\n{players_msg}"
331
- if config.l4_show_ip:
332
- msg += f"\nconnect {selected_srv['host']}:{selected_srv['port']}"
333
- return msg
334
-
335
187
  try:
336
- right_ip = await _filter_servers(server_json, tj)
188
+ right_ip = await _filter_servers(server_json, tj, map_type)
337
189
 
338
190
  if not right_ip:
339
191
  logger.warning("没有找到符合条件的服务器")
@@ -356,7 +208,7 @@ async def tj_request(command: str = "云", tj="tj"):
356
208
  else:
357
209
  player_msg = "服务器感觉很安静啊"
358
210
 
359
- return _build_message(one_server, player_msg, s)
211
+ return _build_message(one_server, player_msg, s, config)
360
212
 
361
213
  except Exception as e:
362
214
  logger.error(f"tj_request error: {e}")
@@ -76,7 +76,7 @@ connect {host}:{port}"""
76
76
  text: str,
77
77
  font: ImageFont.FreeTypeFont,
78
78
  draw: ImageDraw.ImageDraw,
79
- ) -> Image.Image:
79
+ ) -> Image.Image: # type: ignore # 明确返回类型
80
80
  """在图片上绘制文本
81
81
  Args:
82
82
  text: 要绘制的文本
@@ -0,0 +1,176 @@
1
+ from typing import Dict, List, Optional, Tuple, Union, cast
2
+
3
+ from nonebot.log import logger
4
+
5
+ from ..l4_image import msg_to_image
6
+ from ..utils.api.models import NserverOut
7
+ from ..utils.api.request import L4API
8
+ from .draw_msg import convert_duration, draw_one_ip, get_much_server
9
+
10
+
11
+ def _get_server_json(
12
+ command: str,
13
+ allhost: Dict[str, List[NserverOut]],
14
+ ) -> Optional[list]:
15
+ """
16
+ 根据命令获取服务器JSON列表
17
+
18
+ Args:
19
+ command (str): 服务器组名
20
+ ALLHOST (Dict): 全局服务器字典
21
+
22
+ Returns:
23
+ Optional[list]: 服务器JSON列表,未找到组时返回None
24
+ """
25
+ if command:
26
+ return allhost.get(command)
27
+ server_json = []
28
+ for servers in allhost.values():
29
+ server_json.extend(servers)
30
+ return server_json
31
+
32
+
33
+ async def _handle_group_info(
34
+ server_json: list,
35
+ command: str,
36
+ is_img: bool,
37
+ ) -> Union[bytes, str, None]:
38
+ """
39
+ 处理服务器组信息请求
40
+
41
+ Args:
42
+ server_json (list): 服务器JSON列表
43
+ command (str): 服务器组名
44
+ is_img (bool): 是否返回图片格式
45
+
46
+ Returns:
47
+ Union[bytes, str, None]: 图片格式返回bytes,否则返回服务器列表
48
+ """
49
+ logger.info(f"正在请求组服务器信息 {command}")
50
+ server_dict = await get_much_server(server_json, command)
51
+ if is_img:
52
+ return await msg_to_image(server_dict)
53
+ return str(server_dict)
54
+
55
+
56
+ async def get_single_server_info(
57
+ server_json: list,
58
+ _id: str,
59
+ ) -> Optional[Tuple[str, int]]:
60
+ """
61
+ 获取单个服务器的host和port信息
62
+
63
+ Args:
64
+ server_json (list): 服务器JSON列表
65
+ _id (str): 服务器ID
66
+
67
+ Returns:
68
+ Optional[Tuple[str, int]]: 返回(host, port)元组,未找到返回None
69
+ """
70
+ logger.info("正在获取单服务器信息")
71
+ for i in server_json:
72
+ if str(_id) == str(i["id"]):
73
+ return i["host"], i["port"]
74
+ return None
75
+
76
+
77
+ async def _handle_single_server(
78
+ server_json: list,
79
+ _id: str,
80
+ is_img: bool,
81
+ ) -> Union[bytes, str, None]:
82
+ """
83
+ 处理单个服务器信息请求
84
+
85
+ Args:
86
+ server_json (list): 服务器JSON列表
87
+ _id (str): 服务器ID
88
+ is_img (bool): 是否返回图片格式
89
+
90
+ Returns:
91
+ Union[bytes, str, None]: 找到服务器时返回信息,否则返回None
92
+ """
93
+ server_info = await get_single_server_info(server_json, _id)
94
+ if server_info is None:
95
+ return None
96
+
97
+ host, port = server_info
98
+ out_msg = await draw_one_ip(host, port)
99
+ if is_img:
100
+ return cast(bytes, out_msg)
101
+ return out_msg
102
+
103
+
104
+ async def _filter_servers(
105
+ servers: list,
106
+ tj_mode: str,
107
+ map_type: str = "普通药役",
108
+ ) -> list:
109
+ """筛选符合条件的服务器
110
+ Args:
111
+ servers: 服务器列表
112
+ tj_mode: 筛选模式('tj'或'zl')
113
+ map_type: 地图类型筛选条件
114
+ Returns:
115
+ 符合条件的服务器列表
116
+ """
117
+ filtered = []
118
+ for i in servers:
119
+ ser_list = await L4API.a2s_info([(i["host"], i["port"])], is_player=True)
120
+ if not ser_list:
121
+ continue
122
+
123
+ srv = ser_list[0][0]
124
+ players = ser_list[0][1]
125
+
126
+ if tj_mode == "tj" and map_type in srv.map_name:
127
+ score = sum(p.score for p in players[:4])
128
+ t = srv.map_name.split("[")[-1].split("特")[0]
129
+ if t.isdigit() and int(t) * 50 < score:
130
+ logger.info(
131
+ f"符合TJ条件的服务器: {i['host']}:{i['port']}, 地图: {srv.map_name}, 分数: {score}",
132
+ )
133
+ filtered.append(i)
134
+ elif tj_mode == "zl" and map_type in srv.map_name and len(players) <= 4:
135
+ logger.info(
136
+ f"符合ZL条件的服务器: {i['host']}:{i['port']}, 地图: {srv.map_name}, 玩家数: {len(players)}",
137
+ )
138
+ filtered.append(i)
139
+ return filtered
140
+
141
+
142
+ async def _format_players(player_list: list) -> str:
143
+ """格式化玩家信息
144
+ Args:
145
+ player_list: 玩家对象列表
146
+ Returns:
147
+ 格式化后的玩家信息字符串
148
+ """
149
+ durations = [await convert_duration(p.duration) for p in player_list]
150
+ max_duration_len = max(len(str(d)) for d in durations)
151
+ max_score_len = max(len(str(p.score)) for p in player_list)
152
+ return "\n".join(
153
+ f"[{p.score:>{max_score_len}}] | {durations[i]:^{max_duration_len}} | {p.name[0]}***{p.name[-1]}"
154
+ for i, p in enumerate(player_list)
155
+ )
156
+
157
+
158
+ def _build_message(srv_info, players_msg: str, selected_srv: dict, config) -> str:
159
+ """构建服务器信息消息
160
+ Args:
161
+ srv_info: 服务器信息对象
162
+ players_msg: 格式化后的玩家信息
163
+ selected_srv: 选中的服务器信息
164
+ config: 配置对象
165
+ Returns:
166
+ 完整的消息字符串
167
+ """
168
+ msg = f"""*{srv_info.server_name}*
169
+ 游戏: {srv_info.folder}
170
+ 地图: {srv_info.map_name}
171
+ 人数: {srv_info.player_count}/{srv_info.max_players}"""
172
+ if srv_info.ping is not None:
173
+ msg += f"\nping: {srv_info.ping * 1000:.0f}ms\n{players_msg}"
174
+ if config.l4_show_ip:
175
+ msg += f"\nconnect {selected_srv['host']}:{selected_srv['port']}"
176
+ return msg
@@ -9,12 +9,11 @@ import a2s
9
9
  import aiofiles
10
10
  import ujson as js
11
11
  import ujson as json
12
- from bs4 import BeautifulSoup
12
+ from bs4 import BeautifulSoup, Tag
13
13
  from httpx import AsyncClient
14
+ from nonebot.log import logger
14
15
 
15
16
  from ...config import config
16
-
17
- # from nonebot.log import logger
18
17
  from ..utils import split_maohao
19
18
  from .api import AnnePlayerApi, AnneSearchApi, anne_ban
20
19
  from .models import (
@@ -42,6 +41,23 @@ class L4D2Api:
42
41
  "Content-Type": "application/x-www-form-urlencoded",
43
42
  }
44
43
 
44
+ def safe_select(self, element: Optional[Tag], selector: str) -> List[Any]:
45
+ """安全地调用 select 方法"""
46
+ if isinstance(element, Tag):
47
+ return element.select(selector)
48
+ return []
49
+
50
+ def safe_find_all(
51
+ self,
52
+ element: Optional[Tag],
53
+ tag: str,
54
+ class_: str = "",
55
+ ) -> List[Any]:
56
+ """安全地调用 find_all 方法"""
57
+ if isinstance(element, Tag):
58
+ return element.find_all(tag, class_=class_)
59
+ return []
60
+
45
61
  async def a2s_info(
46
62
  self,
47
63
  ip_list: List[Tuple[str, int]],
@@ -53,28 +69,29 @@ class L4D2Api:
53
69
  msg_list: List[
54
70
  Tuple[Union[a2s.SourceInfo[str], a2s.GoldSrcInfo[str]], List[a2s.Player]]
55
71
  ] = []
56
- sorted_msg_list = []
57
- tasks = [] # 用来保存异步任务
58
- if ip_list != []:
59
- for index, i in enumerate(ip_list):
60
- try:
61
- tasks.append(
62
- asyncio.create_task(
63
- self.process_message(
64
- i,
65
- index,
66
- is_server,
67
- is_player,
68
- ),
69
- ),
70
- )
71
- except ValueError:
72
- continue # 处理异常情况
73
72
 
74
- msg_list = await asyncio.gather(*tasks)
75
- sorted_msg_list = sorted(msg_list, key=lambda x: x[0].steam_id)
73
+ if ip_list:
74
+ tasks = [
75
+ asyncio.create_task(
76
+ self.process_message(ip, index, is_server, is_player),
77
+ )
78
+ for index, ip in enumerate(ip_list)
79
+ ]
76
80
 
77
- return sorted_msg_list
81
+ try:
82
+ results = await asyncio.gather(*tasks)
83
+ msg_list = [r for r in results if r is not None]
84
+ except Exception as e:
85
+ logger.error(f"获取服务器信息时发生错误: {e}")
86
+
87
+ # 使用稳定的排序方式,避免服务器频繁变动位置
88
+ return sorted(
89
+ msg_list,
90
+ key=lambda x: (
91
+ getattr(x[0], "steam_id", float("inf")) is None,
92
+ getattr(x[0], "steam_id", float("inf")),
93
+ ),
94
+ )
78
95
 
79
96
  async def process_message(
80
97
  self,
@@ -235,14 +252,12 @@ class L4D2Api:
235
252
  tag_path = Path(Path(config.l4_path) / f"l4d2/{tag}.json")
236
253
 
237
254
  async with aiofiles.open(tag_path, "w", encoding="utf-8") as f:
238
- print(Path(Path(config.l4_path) / f"l4d2/{tag}.json"))
239
255
  up_data = {}
240
256
  for server in server_list:
241
257
  new_dict = {}
242
258
  new_dict["id"] = int(server.index) + 1
243
259
  new_dict["ip"] = server.host + ":" + str(server.port)
244
260
  up_data.update(new_dict)
245
- print(up_data)
246
261
  json.dump(up_data, f, ensure_ascii=False, indent=4)
247
262
  return server_list
248
263
 
@@ -277,7 +292,7 @@ class L4D2Api:
277
292
  "last_time": td_tags,
278
293
  },
279
294
  )
280
- print(server_list)
295
+ logger.debug(server_list)
281
296
  return cast(List[AnneSearch], server_list)
282
297
 
283
298
  async def get_anne_playerdetail(self, steamid: str):
@@ -307,7 +322,7 @@ class L4D2Api:
307
322
  "table",
308
323
  class_="table content-table-noborder text-left",
309
324
  )
310
- print(len(tbody_tags))
325
+
311
326
  info_tag = tbody_tags[0]
312
327
  detail_tag = tbody_tags[1]
313
328
  error_tag = tbody_tags[2]
@@ -0,0 +1,30 @@
1
+ from typing import Union
2
+
3
+ from nonebot_plugin_alconna import UniMessage
4
+
5
+
6
+ async def out_msg_out(
7
+ msg: Union[str, bytes, UniMessage],
8
+ is_connect: bool = False,
9
+ host: str = "",
10
+ port: str = "",
11
+ ):
12
+ """
13
+ 统一消息输出函数
14
+
15
+ Args:
16
+ msg: 要输出的消息内容
17
+ is_connect: 是否为连接消息
18
+ host: 服务器地址
19
+ port: 服务器端口
20
+ """
21
+ if isinstance(msg, UniMessage):
22
+ return await msg.finish()
23
+ if isinstance(msg, str):
24
+ await UniMessage.text(msg).finish()
25
+ if is_connect:
26
+ out = UniMessage.image(raw=msg) + UniMessage.text(
27
+ f"连接到服务器: {host}:{port}",
28
+ )
29
+ return await out.finish()
30
+ return await UniMessage.image(raw=msg).finish()
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nonebot-plugin-l4d2-server"
3
- version = "1.0.4"
3
+ version = "1.0.5"
4
4
  description = "L4D2 server related operations plugin for NoneBot2"
5
5
  authors = [
6
6
  { name = "Agnes_Digital", email = "Z735803792@163.com" },
@@ -24,13 +24,13 @@ dependencies = [
24
24
  "aiohttp>=3.8.4",
25
25
  "jinja2>=3.0.0",
26
26
  "srctools>=2.3.9",
27
- "httpx>=0.22.0,<0.24.1",
27
+ "httpx>=0.22.0",
28
28
  "msgspec>=0.18.0",
29
29
  "python-a2s>=1.4.1",
30
30
  "ujson>=5.10.0",
31
31
  "lxml>=5.2.2",
32
32
  "rcon>=2.1.0",
33
- "pillow>10",
33
+ "pillow>10.0.0",
34
34
  "bs4>=0.0.2",
35
35
  "rarfile>=4.2",
36
36
  "pyunpack>=0.3",