nonebot-plugin-l4d2-server 1.0.3__tar.gz → 1.0.4__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.
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/PKG-INFO +17 -14
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/README.md +15 -12
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/__main__.py +77 -31
- nonebot_plugin_l4d2_server-1.0.4/nonebot_plugin_l4d2_server/config.py +94 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/__init__.py +1 -1
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_request/__init__.py +109 -29
- nonebot_plugin_l4d2_server-1.0.4/nonebot_plugin_l4d2_server/l4_request/draw_msg.py +231 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/utils/api/models.py +1 -1
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/utils/api/request.py +29 -10
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/utils/utils.py +11 -2
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/pyproject.toml +2 -2
- nonebot_plugin_l4d2_server-1.0.3/nonebot_plugin_l4d2_server/config.py +0 -45
- nonebot_plugin_l4d2_server-1.0.3/nonebot_plugin_l4d2_server/l4_anne/__init__.py +0 -125
- nonebot_plugin_l4d2_server-1.0.3/nonebot_plugin_l4d2_server/l4_anne/ranne.py +0 -18
- nonebot_plugin_l4d2_server-1.0.3/nonebot_plugin_l4d2_server/l4_request/draw_msg.py +0 -94
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/LICENSE +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/__init__.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/data/font/loli.ttf +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/Help.json +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/draw.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//344/273/213/347/273/215.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//344/273/273/345/212/241.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//344/277/241/346/201/257.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//345/205/254/345/221/212.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//345/210/200/345/211/221.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//345/210/207/346/215/242.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//345/210/240/351/231/244.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//345/210/267/346/226/260.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//345/215/241/347/273/204.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//345/223/252/351/207/214.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//345/234/260/345/233/276.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//345/257/274/345/205/245.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//345/257/274/345/207/272.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//345/275/261.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//346/213/274/345/233/276.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//346/216/242/347/264/242.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//346/216/250/351/200/201.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//346/224/266/351/233/206.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//346/224/273/347/225/245.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//346/233/264/346/226/260.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//346/235/220/346/226/231.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//346/237/245/350/257/242.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//346/240/241/351/252/214.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//346/257/217/346/234/210.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//346/267/261/346/270/212.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//346/267/273/345/212/240.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//346/270/205/351/231/244.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//347/212/266/346/200/201.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//347/255/276/345/210/260.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//347/273/221/345/256/232.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//350/241/250.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//350/241/250/346/203/205.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//350/247/222/350/211/262.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//350/256/260/345/275/225.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//351/205/215/347/275/256.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/icon//351/207/215/345/220/257.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/texture2d/badge.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/texture2d/banner.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/texture2d/bg.jpg +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/texture2d/button.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_help/texture2d/icon.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/__init__.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/anne_pil.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/convert.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/download.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/html_img.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/image_tools.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/anne/anne.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/anne/back.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/anne/back1.jpg +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/anne/group_ip.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/anne/ip.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/head/head.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/header/logo.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/header/player1.jpg +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/template/Bocchi_The_Rock.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/template/Bocchi_The_Rock.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/template/HYPixel11pxU-2.ttf +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/template/Pixel.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/template/Pixel.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/template/Rainbow.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/template/Rainbow.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/template/Tutumianhuatang-Bold-2.ttf +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/template/bilibili.svg +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/template/fingerprint.svg +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/template/github.svg +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/template/l.svg +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/template/m.svg +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/template/normal.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/template/vac.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/template/vac_white.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/template/vue.css +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/img/template/w.svg +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/model.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_image/vtfs.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_local/__init__.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_local/file.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/l4_request/utils.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/utils/api/api.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.3 → nonebot_plugin_l4d2_server-1.0.4}/nonebot_plugin_l4d2_server/utils/database/models.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: nonebot-plugin-l4d2-server
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.4
|
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>
|
@@ -32,7 +32,7 @@ Requires-Dist: ujson>=5.10.0
|
|
32
32
|
Requires-Dist: lxml>=5.2.2
|
33
33
|
Requires-Dist: rcon>=2.1.0
|
34
34
|
Requires-Dist: pillow>10
|
35
|
-
Requires-Dist:
|
35
|
+
Requires-Dist: bs4>=0.0.2
|
36
36
|
Requires-Dist: rarfile>=4.2
|
37
37
|
Requires-Dist: pyunpack>=0.3
|
38
38
|
Requires-Dist: aiofiles>=24.1.0
|
@@ -47,7 +47,7 @@ Description-Content-Type: text/markdown
|
|
47
47
|
|
48
48
|
<div align="center">
|
49
49
|
|
50
|
-
# nonebot_plugin_l4d2_server 1.0.
|
50
|
+
# nonebot_plugin_l4d2_server 1.0.4
|
51
51
|
|
52
52
|
_✨Nonebot & Left 4 Dead 2 server操作✨_
|
53
53
|
<div align = "center">
|
@@ -77,15 +77,12 @@ _✨Nonebot & Left 4 Dead 2 server操作✨_
|
|
77
77
|
|
78
78
|
## 顶置公告(如果以前用0.x.x版本暂时别更新)
|
79
79
|
|
80
|
-
- **版本** 1.x.x
|
80
|
+
- **版本** 1.x.x进行了破坏式更新,使用旧插件的不要更新
|
81
81
|
|
82
|
-
##
|
82
|
+
## 指令
|
83
83
|
|
84
|
-
-
|
85
|
-
-
|
86
|
-
- 取消了git拉取更新(nb规范用pypi)
|
87
|
-
- 增加pil和浏览器渲染做选择(可以选择pil以节省性能性能)
|
88
|
-
- 删除无用部分(依赖太多难以维护)
|
84
|
+
- 在json文件设置的前缀指令,例如设置"云",则指令 云 输出组服务器,云1 输出1号服务器
|
85
|
+
- l4图片开启/关闭 超管指令 可以修改输出单图是否为图片输出
|
89
86
|
|
90
87
|
## 安装
|
91
88
|
|
@@ -142,8 +139,7 @@ conda install nonebot-plugin-l4d2-server
|
|
142
139
|
## 主要功能
|
143
140
|
|
144
141
|
- [ ] 求生服务器-本地多路径操作(传地图等)
|
145
|
-
- [
|
146
|
-
- [ ] [求生电信服anne](https://github.com/fantasylidong/CompetitiveWithAnne)[查询~](https://sb.trygek.com/l4d_stats/ranking/index.php)
|
142
|
+
- [x] 批量查询指定ip服务器状态和玩家
|
147
143
|
|
148
144
|
## [数据结构](./docs/standand.md)
|
149
145
|
|
@@ -152,8 +148,6 @@ conda install nonebot-plugin-l4d2-server
|
|
152
148
|
## env设置
|
153
149
|
|
154
150
|
"""bash
|
155
|
-
l4_anne = False
|
156
|
-
"""是否启用anne电信服相关功能"""
|
157
151
|
l4_enable = True
|
158
152
|
"""是否全局启用求生功能"""
|
159
153
|
l4_image = False
|
@@ -172,6 +166,15 @@ conda install nonebot-plugin-l4d2-server
|
|
172
166
|
- 缤纷彩虹
|
173
167
|
"""
|
174
168
|
|
169
|
+
## 和0.x.x更改部分
|
170
|
+
|
171
|
+
- 取消了网页控制台(没有卵用)
|
172
|
+
- 取消了自动重启(与其他插件功能重复)
|
173
|
+
- 取消了git拉取更新(nb规范用pypi)
|
174
|
+
- 增加pil和浏览器渲染做选择(可以选择pil以节省性能性能)
|
175
|
+
- 删除无用部分(依赖太多难以维护)
|
176
|
+
- 删除了anne部分,已移植到[这里](https://github.com/Agnes4m/L4D2UID),通过core插件调用
|
177
|
+
|
175
178
|
## 其他
|
176
179
|
|
177
180
|
- 本人技术很差,如果您有发现BUG或者更好的建议,欢迎提Issue & Pr
|
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
<div align="center">
|
9
9
|
|
10
|
-
# nonebot_plugin_l4d2_server 1.0.
|
10
|
+
# nonebot_plugin_l4d2_server 1.0.4
|
11
11
|
|
12
12
|
_✨Nonebot & Left 4 Dead 2 server操作✨_
|
13
13
|
<div align = "center">
|
@@ -37,15 +37,12 @@ _✨Nonebot & Left 4 Dead 2 server操作✨_
|
|
37
37
|
|
38
38
|
## 顶置公告(如果以前用0.x.x版本暂时别更新)
|
39
39
|
|
40
|
-
- **版本** 1.x.x
|
40
|
+
- **版本** 1.x.x进行了破坏式更新,使用旧插件的不要更新
|
41
41
|
|
42
|
-
##
|
42
|
+
## 指令
|
43
43
|
|
44
|
-
-
|
45
|
-
-
|
46
|
-
- 取消了git拉取更新(nb规范用pypi)
|
47
|
-
- 增加pil和浏览器渲染做选择(可以选择pil以节省性能性能)
|
48
|
-
- 删除无用部分(依赖太多难以维护)
|
44
|
+
- 在json文件设置的前缀指令,例如设置"云",则指令 云 输出组服务器,云1 输出1号服务器
|
45
|
+
- l4图片开启/关闭 超管指令 可以修改输出单图是否为图片输出
|
49
46
|
|
50
47
|
## 安装
|
51
48
|
|
@@ -102,8 +99,7 @@ conda install nonebot-plugin-l4d2-server
|
|
102
99
|
## 主要功能
|
103
100
|
|
104
101
|
- [ ] 求生服务器-本地多路径操作(传地图等)
|
105
|
-
- [
|
106
|
-
- [ ] [求生电信服anne](https://github.com/fantasylidong/CompetitiveWithAnne)[查询~](https://sb.trygek.com/l4d_stats/ranking/index.php)
|
102
|
+
- [x] 批量查询指定ip服务器状态和玩家
|
107
103
|
|
108
104
|
## [数据结构](./docs/standand.md)
|
109
105
|
|
@@ -112,8 +108,6 @@ conda install nonebot-plugin-l4d2-server
|
|
112
108
|
## env设置
|
113
109
|
|
114
110
|
"""bash
|
115
|
-
l4_anne = False
|
116
|
-
"""是否启用anne电信服相关功能"""
|
117
111
|
l4_enable = True
|
118
112
|
"""是否全局启用求生功能"""
|
119
113
|
l4_image = False
|
@@ -132,6 +126,15 @@ conda install nonebot-plugin-l4d2-server
|
|
132
126
|
- 缤纷彩虹
|
133
127
|
"""
|
134
128
|
|
129
|
+
## 和0.x.x更改部分
|
130
|
+
|
131
|
+
- 取消了网页控制台(没有卵用)
|
132
|
+
- 取消了自动重启(与其他插件功能重复)
|
133
|
+
- 取消了git拉取更新(nb规范用pypi)
|
134
|
+
- 增加pil和浏览器渲染做选择(可以选择pil以节省性能性能)
|
135
|
+
- 删除无用部分(依赖太多难以维护)
|
136
|
+
- 删除了anne部分,已移植到[这里](https://github.com/Agnes4m/L4D2UID),通过core插件调用
|
137
|
+
|
135
138
|
## 其他
|
136
139
|
|
137
140
|
- 本人技术很差,如果您有发现BUG或者更好的建议,欢迎提Issue & Pr
|
@@ -16,7 +16,7 @@
|
|
16
16
|
"""
|
17
17
|
|
18
18
|
from pathlib import Path
|
19
|
-
from typing import TYPE_CHECKING, List, Optional
|
19
|
+
from typing import TYPE_CHECKING, List, Optional, Union
|
20
20
|
|
21
21
|
import aiofiles
|
22
22
|
import ujson as json
|
@@ -24,10 +24,11 @@ from nonebot.adapters import Message
|
|
24
24
|
from nonebot.log import logger
|
25
25
|
from nonebot.matcher import Matcher
|
26
26
|
from nonebot.params import CommandArg, CommandStart, RawCommand
|
27
|
+
from nonebot.permission import SUPERUSER
|
27
28
|
from nonebot.plugin import on_command
|
28
29
|
from nonebot_plugin_alconna import UniMessage
|
29
30
|
|
30
|
-
from .config import config
|
31
|
+
from .config import config, config_manager
|
31
32
|
from .l4_help import get_l4d2_core_help
|
32
33
|
from .l4_local import * # noqa: F403
|
33
34
|
from .l4_request import (
|
@@ -45,7 +46,7 @@ if TYPE_CHECKING:
|
|
45
46
|
|
46
47
|
reload_ip()
|
47
48
|
|
48
|
-
l4_help = on_command("l4help", aliases={"
|
49
|
+
l4_help = on_command("l4help", aliases={"l4d2帮助"})
|
49
50
|
l4_request = on_command("anne", aliases=COMMAND, priority=10)
|
50
51
|
l4_reload = on_command("l4reload", aliases={"l4刷新,l4重载"})
|
51
52
|
l4_all = on_command("l4all", aliases={"l4全服"})
|
@@ -59,13 +60,11 @@ config_path = Path(config.l4_path) / "config.json"
|
|
59
60
|
|
60
61
|
|
61
62
|
@l4_help.handle()
|
62
|
-
async def _(
|
63
|
+
async def _():
|
63
64
|
"""帮助"""
|
64
65
|
logger.info("开始执行[l4d2帮助]")
|
65
66
|
im = await get_l4d2_core_help()
|
66
|
-
|
67
|
-
await matcher.finish(im)
|
68
|
-
await UniMessage.image(raw=im).send()
|
67
|
+
await out_msg_out(im)
|
69
68
|
|
70
69
|
|
71
70
|
@l4_request.handle()
|
@@ -74,11 +73,31 @@ async def _(
|
|
74
73
|
command: str = RawCommand(),
|
75
74
|
args: Message = CommandArg(),
|
76
75
|
):
|
77
|
-
"""
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
76
|
+
"""
|
77
|
+
异步函数,用于处理特定的指令。
|
78
|
+
|
79
|
+
Args:
|
80
|
+
start (str, optional): 指令的开头部分,默认为 CommandStart() 返回的值。
|
81
|
+
command (str, optional): 完整的指令字符串,默认为 RawCommand() 返回的值。
|
82
|
+
args (Message, optional): 指令后的参数,默认为 CommandArg() 返回的值。
|
83
|
+
|
84
|
+
Returns:
|
85
|
+
None
|
86
|
+
|
87
|
+
Examples:
|
88
|
+
示例指令:"/橘5"
|
89
|
+
- start: "/" (指令的开头部分)
|
90
|
+
- command: "/橘" (完整的指令字符串)
|
91
|
+
- args: "5" (指令后的参数)
|
92
|
+
|
93
|
+
Notes:
|
94
|
+
1. 如果 start 存在,会将 command 中的 start 部分替换为空字符串。
|
95
|
+
2. 如果 command 等于 "anne",则将其替换为 "云"。
|
96
|
+
3. 提取 args 中的纯文本内容,如果内容非空且不是数字,则返回。
|
97
|
+
4. 如果 args 为空,则将其设置为 None。
|
98
|
+
5. 使用 logger 记录处理过程中的信息。
|
99
|
+
6. 调用 get_server_detail 函数获取服务器详情,并根据返回结果发送相应的消息。
|
100
|
+
7. 如果 get_server_detail 返回 None,则发送 "服务器无响应" 的文本消息。
|
82
101
|
"""
|
83
102
|
|
84
103
|
if start:
|
@@ -93,12 +112,9 @@ async def _(
|
|
93
112
|
logger.info(f"组:{command} ;数字:{_id}")
|
94
113
|
msg = await get_server_detail(command, _id)
|
95
114
|
if msg is not None:
|
96
|
-
|
97
|
-
await UniMessage.text(msg).finish()
|
98
|
-
if isinstance(msg, bytes):
|
99
|
-
await UniMessage.image(raw=msg).finish()
|
115
|
+
await out_msg_out(msg, is_connect=config.l4_image)
|
100
116
|
else:
|
101
|
-
await
|
117
|
+
await out_msg_out("服务器无响应")
|
102
118
|
|
103
119
|
|
104
120
|
@l4_find_player.handle()
|
@@ -120,32 +136,26 @@ async def _(
|
|
120
136
|
if len(tag_list) == 2:
|
121
137
|
group, name = tag_list
|
122
138
|
await UniMessage.text(f"正在查询{group}组").send()
|
123
|
-
out: List[OutServer] = await get_server_detail(group, is_img=False) # type: ignore
|
139
|
+
out: List[OutServer] = await get_server_detail(group=group, is_img=False) # type: ignore
|
124
140
|
out_msg = "未找到玩家"
|
125
141
|
for one in out:
|
126
142
|
for player in one["player"]:
|
127
143
|
if name in player.name:
|
128
144
|
out_msg = await get_ip_server(f"{one['host']}:{one['port']}")
|
129
145
|
|
130
|
-
return await
|
146
|
+
return await out_msg_out(out_msg)
|
131
147
|
|
132
148
|
|
133
149
|
@l4_all.handle()
|
134
150
|
async def _():
|
135
|
-
await
|
151
|
+
await out_msg_out(await get_all_server_detail())
|
136
152
|
|
137
153
|
|
138
154
|
@l4_connect.handle()
|
139
155
|
async def _(args: Message = CommandArg()):
|
140
156
|
ip: Optional[str] = args.extract_plain_text()
|
141
157
|
if ip is not None:
|
142
|
-
await
|
143
|
-
|
144
|
-
|
145
|
-
# anne部分
|
146
|
-
if config.l4_anne:
|
147
|
-
logger.info("加载anne功能")
|
148
|
-
from .l4_anne import * # noqa: F403
|
158
|
+
await out_msg_out(await get_ip_server(ip), is_connect=config.l4_image)
|
149
159
|
|
150
160
|
|
151
161
|
@l4_reload.handle()
|
@@ -161,7 +171,7 @@ async def _(args: Message = CommandArg()):
|
|
161
171
|
for tag, url in ip_json.items():
|
162
172
|
logger.info(f"重载{tag}的ip")
|
163
173
|
await L4API.get_sourceban(tag, url)
|
164
|
-
await
|
174
|
+
await out_msg_out("重载ip完成")
|
165
175
|
|
166
176
|
|
167
177
|
l4_add_ban = on_command("l4addban", aliases={"l4添加ban"})
|
@@ -192,7 +202,7 @@ async def _(args: Message = CommandArg()):
|
|
192
202
|
await UniMessage.text(f"文件写入失败: {e}").finish()
|
193
203
|
|
194
204
|
await L4API.get_sourceban(arg[0], arg[1])
|
195
|
-
await
|
205
|
+
await out_msg_out(f"添加成功\n组名: {arg[0]}\n网址: {arg[1]}")
|
196
206
|
|
197
207
|
|
198
208
|
l4_del_ban = on_command("l4delban", aliases={"l4删除ban", "l4移除ban"})
|
@@ -219,7 +229,7 @@ async def _(args: Message = CommandArg()):
|
|
219
229
|
del config_data[arg[0]]
|
220
230
|
async with aiofiles.open(config_path, "w", encoding="utf-8") as f:
|
221
231
|
json.dump(config_data, f, ensure_ascii=False, indent=4)
|
222
|
-
await
|
232
|
+
await out_msg_out(f"删除成功,组名:{arg[0]}")
|
223
233
|
elif len(arg) == 2:
|
224
234
|
if not Path(Path(config.l4_path) / "config.json").is_file():
|
225
235
|
await UniMessage.text("没有添加过组名").finish()
|
@@ -236,7 +246,7 @@ async def _(args: Message = CommandArg()):
|
|
236
246
|
config_datas[arg[0]] = arg[1]
|
237
247
|
async with aiofiles.open(config_path, "w", encoding="utf-8") as f:
|
238
248
|
json.dump(config_datas, f, ensure_ascii=False, indent=4)
|
239
|
-
await
|
249
|
+
await out_msg_out(f"修改成功,组名:{arg[0]},网址:{arg[1]}")
|
240
250
|
|
241
251
|
|
242
252
|
@ld_tj.handle()
|
@@ -249,3 +259,39 @@ async def _(matcher: Matcher):
|
|
249
259
|
async def _(matcher: Matcher):
|
250
260
|
await matcher.send("正在寻找牢房信息")
|
251
261
|
await matcher.finish(await tj_request("云", "zl"))
|
262
|
+
|
263
|
+
|
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
|
+
## 以下为配置修改
|
283
|
+
|
284
|
+
img_trung = on_command("l4img", aliases={"l4图片"}, permission=SUPERUSER)
|
285
|
+
|
286
|
+
|
287
|
+
@img_trung.handle()
|
288
|
+
async def _(args: Message = CommandArg()):
|
289
|
+
arg = args.extract_plain_text().strip().lower()
|
290
|
+
if arg == "开启":
|
291
|
+
config_manager.update_image_config(enabled=True)
|
292
|
+
await out_msg_out("[l4]已开启图片模式")
|
293
|
+
elif arg == "关闭":
|
294
|
+
config_manager.update_image_config(enabled=False)
|
295
|
+
await out_msg_out("[l4]已关闭图片模式")
|
296
|
+
else:
|
297
|
+
await UniMessage.text("请在参数后加上开启或关闭").finish()
|
@@ -0,0 +1,94 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
|
3
|
+
from nonebot import get_plugin_config
|
4
|
+
from nonebot.log import logger
|
5
|
+
from pydantic import BaseModel
|
6
|
+
|
7
|
+
DATAPATH = Path(__file__).parent.joinpath("data")
|
8
|
+
DATAOUT = Path("data/L4D2")
|
9
|
+
if not Path(DATAOUT / "l4d2.json").exists():
|
10
|
+
logger.info("文件 l4d2.json 不存在,已创建并初始化为 {}")
|
11
|
+
Path(DATAOUT / "l4d2.json").write_text("{}", encoding="utf-8")
|
12
|
+
print(DATAOUT.absolute())
|
13
|
+
server_all_path = DATAOUT / "l4d2"
|
14
|
+
server_all_path.mkdir(parents=True, exist_ok=True)
|
15
|
+
|
16
|
+
ICONPATH = DATAPATH / "icon"
|
17
|
+
|
18
|
+
global map_index
|
19
|
+
map_index = 0
|
20
|
+
|
21
|
+
|
22
|
+
class ConfigModel(BaseModel):
|
23
|
+
l4_enable: bool = True
|
24
|
+
"""是否全局启用求生功能"""
|
25
|
+
l4_image: bool = True
|
26
|
+
"""是否启用图片"""
|
27
|
+
l4_connect: bool = True
|
28
|
+
"""是否在查服命令后加入connect ip"""
|
29
|
+
l4_path: str = "data/L4D2"
|
30
|
+
"""插件数据路径"""
|
31
|
+
l4_players: int = 4
|
32
|
+
"""查询总图的时候展示的用户数量"""
|
33
|
+
l4_style: str = "default"
|
34
|
+
"""图片风格"""
|
35
|
+
l4_font: str = str(Path(__file__).parent.joinpath("data/font/loli.ttf"))
|
36
|
+
"""字体"""
|
37
|
+
l4_show_ip: bool = True
|
38
|
+
"""单服务器查询时候是否展示ip直连地址"""
|
39
|
+
l4_local: list[str] = []
|
40
|
+
"""本地服务器路径,填写路径下有`steam_appid.txt`文件"""
|
41
|
+
|
42
|
+
|
43
|
+
config = get_plugin_config(ConfigModel)
|
44
|
+
|
45
|
+
|
46
|
+
class ConfigManager:
|
47
|
+
"""配置项管理类,提供类型安全的配置更新方法"""
|
48
|
+
|
49
|
+
def __init__(self):
|
50
|
+
self._config = config
|
51
|
+
|
52
|
+
def update_image_config(self, enabled: bool) -> None:
|
53
|
+
"""更新图片配置
|
54
|
+
|
55
|
+
Args:
|
56
|
+
enabled: 是否启用图片功能
|
57
|
+
"""
|
58
|
+
self._config.l4_image = enabled
|
59
|
+
|
60
|
+
def update_style_config(self, style: str) -> None:
|
61
|
+
"""更新图片风格配置
|
62
|
+
|
63
|
+
Args:
|
64
|
+
style: 图片风格名称
|
65
|
+
"""
|
66
|
+
if not isinstance(style, str):
|
67
|
+
raise TypeError("style必须是字符串")
|
68
|
+
self._config.l4_style = style
|
69
|
+
|
70
|
+
def update_connect_config(self, enabled: bool) -> None:
|
71
|
+
"""更新connect ip配置
|
72
|
+
|
73
|
+
Args:
|
74
|
+
enabled: 是否在查服命令后加入connect ip
|
75
|
+
"""
|
76
|
+
self._config.l4_connect = enabled
|
77
|
+
|
78
|
+
def update(self, **kwargs) -> None:
|
79
|
+
"""通用配置更新方法
|
80
|
+
|
81
|
+
Args:
|
82
|
+
**kwargs: 要更新的配置项键值对
|
83
|
+
|
84
|
+
Raises:
|
85
|
+
ValueError: 当传入无效的配置项时
|
86
|
+
"""
|
87
|
+
for key, value in kwargs.items():
|
88
|
+
if hasattr(self._config, key):
|
89
|
+
setattr(self._config, key, value)
|
90
|
+
else:
|
91
|
+
raise ValueError(f"无效的配置项: {key}")
|
92
|
+
|
93
|
+
|
94
|
+
config_manager = ConfigManager()
|
@@ -10,7 +10,7 @@ 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.
|
13
|
+
__version__ = "1.0.4"
|
14
14
|
TEXT_PATH = Path(__file__).parent / "texture2d"
|
15
15
|
HELP_DATA = Path(__file__).parent / "Help.json"
|
16
16
|
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import random
|
2
|
-
from typing import Dict, List, Optional, cast
|
2
|
+
from typing import Dict, List, Optional, Tuple, Union, cast
|
3
3
|
|
4
4
|
from nonebot.log import logger
|
5
|
+
from nonebot_plugin_alconna import UniMessage
|
5
6
|
|
6
7
|
from ..config import server_all_path
|
7
8
|
from ..l4_image import msg_to_image
|
8
|
-
from ..utils.api.models import AllServer, NserverOut
|
9
|
+
from ..utils.api.models import AllServer, NserverOut
|
9
10
|
from ..utils.api.request import L4API
|
10
11
|
from ..utils.utils import split_maohao
|
11
12
|
from .draw_msg import convert_duration, draw_one_ip, get_much_server
|
@@ -79,48 +80,127 @@ async def get_server_detail(
|
|
79
80
|
command (str): 服务器组名。
|
80
81
|
_id (Optional[str], optional): 服务器ID。默认为None。
|
81
82
|
is_img (bool, optional): 是否返回图片格式的信息。默认为True。
|
83
|
+
return_host_port (bool, optional): 是否返回host和port值。默认为False。
|
82
84
|
|
83
85
|
Returns:
|
84
|
-
Union[bytes,
|
85
|
-
|
86
|
-
|
86
|
+
Union[bytes, str, None, Tuple[str, int]]:
|
87
|
+
如果return_host_port为True且_id不为None,返回(host, port)元组;
|
88
|
+
否则返回服务器详细信息(图片格式返回bytes,文本格式返回str);
|
89
|
+
未找到服务器组返回None。
|
87
90
|
"""
|
88
|
-
|
89
|
-
server_json = ALLHOST.get(command)
|
90
|
-
else:
|
91
|
-
server_json = []
|
92
|
-
for servers in ALLHOST.values():
|
93
|
-
server_json.extend(servers)
|
94
|
-
|
91
|
+
server_json = _get_server_json(command)
|
95
92
|
logger.info(server_json)
|
96
93
|
if server_json is None:
|
97
94
|
logger.warning("未找到这个组")
|
98
95
|
return None
|
99
96
|
|
100
97
|
if _id is None:
|
101
|
-
|
102
|
-
logger.info(f"正在请求组服务器信息 {command}")
|
103
|
-
server_dict = await get_much_server(server_json, command)
|
104
|
-
if is_img:
|
105
|
-
out_msg = await msg_to_image(server_dict)
|
106
|
-
else:
|
107
|
-
out_msg = server_dict
|
108
|
-
return out_msg
|
98
|
+
return await _handle_group_info(server_json, command, is_img)
|
109
99
|
|
110
|
-
|
111
|
-
|
112
|
-
|
100
|
+
_ip = await get_single_server_info(server_json, _id)
|
101
|
+
if _ip is None:
|
102
|
+
logger.warning("未找到这个服务器")
|
103
|
+
return None
|
104
|
+
|
105
|
+
out_msg = await _handle_single_server(server_json, _id, is_img)
|
106
|
+
if isinstance(out_msg, bytes):
|
107
|
+
return UniMessage.image(raw=out_msg) + UniMessage.text(
|
108
|
+
f"connect {_ip[0]}:{_ip[1]}",
|
109
|
+
)
|
110
|
+
if isinstance(out_msg, str):
|
111
|
+
return UniMessage.text(out_msg)
|
112
|
+
return None
|
113
|
+
|
114
|
+
|
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("正在获取单服务器信息")
|
113
171
|
for i in server_json:
|
114
172
|
if str(_id) == str(i["id"]):
|
115
|
-
|
116
|
-
if is_img:
|
117
|
-
return cast(bytes, out_msg)
|
118
|
-
if not is_img:
|
119
|
-
return cast(List[OutServer], out_msg)
|
120
|
-
# print(out_msg)
|
173
|
+
return i["host"], i["port"]
|
121
174
|
return None
|
122
175
|
|
123
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
|
+
|
124
204
|
async def get_group_detail(
|
125
205
|
command: str,
|
126
206
|
):
|