nonebot-plugin-l4d2-server 1.0.6__tar.gz → 1.0.9__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.6 → nonebot_plugin_l4d2_server-1.0.9}/PKG-INFO +1 -1
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/__main__.py +20 -3
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/__init__.py +1 -1
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/convert.py +9 -3
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_local/__init__.py +30 -1
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_request/__init__.py +59 -33
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_request/draw_msg.py +111 -22
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_request/utils.py +5 -8
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/utils/api/request.py +84 -81
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/utils/api/utils.py +1 -1
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/pyproject.toml +1 -1
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/LICENSE +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/README.md +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/__init__.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/config.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/data/font/loli.ttf +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/Help.json +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/draw.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//344/273/213/347/273/215.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//344/273/273/345/212/241.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//344/277/241/346/201/257.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//345/205/254/345/221/212.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//345/210/200/345/211/221.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//345/210/207/346/215/242.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//345/210/240/351/231/244.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//345/210/267/346/226/260.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//345/215/241/347/273/204.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//345/223/252/351/207/214.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//345/234/260/345/233/276.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//345/257/274/345/205/245.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//345/257/274/345/207/272.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//345/275/261.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//346/213/274/345/233/276.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//346/216/242/347/264/242.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//346/216/250/351/200/201.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//346/224/266/351/233/206.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//346/224/273/347/225/245.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//346/233/264/346/226/260.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//346/235/220/346/226/231.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//346/237/245/350/257/242.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//346/240/241/351/252/214.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//346/257/217/346/234/210.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//346/267/261/346/270/212.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//346/267/273/345/212/240.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//346/270/205/351/231/244.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//347/212/266/346/200/201.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//347/255/276/345/210/260.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//347/273/221/345/256/232.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//350/241/250.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//350/241/250/346/203/205.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//350/247/222/350/211/262.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//350/256/260/345/275/225.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//351/205/215/347/275/256.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/icon//351/207/215/345/220/257.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/texture2d/badge.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/texture2d/banner.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/texture2d/bg.jpg +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/texture2d/button.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_help/texture2d/icon.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/__init__.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/download.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/html_img.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/image_tools.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/anne/anne.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/anne/back.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/anne/back1.jpg +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/anne/group_ip.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/anne/ip.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/head/head.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/header/logo.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/header/player1.jpg +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/template/Bocchi_The_Rock.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/template/Bocchi_The_Rock.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/template/HYPixel11pxU-2.ttf +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/template/Pixel.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/template/Pixel.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/template/Rainbow.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/template/Rainbow.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/template/Tutumianhuatang-Bold-2.ttf +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/template/bilibili.svg +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/template/fingerprint.svg +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/template/github.svg +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/template/l.svg +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/template/m.svg +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/template/normal.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/template/vac.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/template/vac_white.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/template/vue.css +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/img/template/w.svg +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/model.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_image/vtfs.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/l4_local/file.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/utils/api/api.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/utils/api/models.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/utils/database/models.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.6 → nonebot_plugin_l4d2_server-1.0.9}/nonebot_plugin_l4d2_server/utils/utils.py +0 -0
@@ -37,10 +37,12 @@ from .l4_request import (
|
|
37
37
|
get_ip_server,
|
38
38
|
get_server_detail,
|
39
39
|
reload_ip,
|
40
|
+
server_find,
|
40
41
|
tj_request,
|
41
42
|
)
|
42
43
|
from .utils.api.request import L4API
|
43
44
|
from .utils.api.utils import out_msg_out
|
45
|
+
from .utils.utils import split_maohao
|
44
46
|
|
45
47
|
if TYPE_CHECKING:
|
46
48
|
from .utils.api.models import OutServer
|
@@ -133,21 +135,30 @@ async def _(
|
|
133
135
|
if len(tag_list) == 1:
|
134
136
|
await UniMessage.text("未设置组,正在全服查找,时间较长").send()
|
135
137
|
name = tag_list[0]
|
136
|
-
out: List[OutServer] = await
|
138
|
+
out: List[OutServer] = await server_find(is_img=False) # type: ignore
|
139
|
+
logger.info(out)
|
140
|
+
logger.info(type(out))
|
137
141
|
out_msg = "未找到玩家"
|
138
142
|
for one in out:
|
143
|
+
logger.info(one)
|
139
144
|
for player in one["player"]:
|
140
145
|
if name in player.name:
|
141
146
|
out_msg = await get_ip_server(f"{one['host']}:{one['port']}")
|
142
147
|
if len(tag_list) == 2:
|
143
148
|
group, name = tag_list
|
144
149
|
await UniMessage.text(f"正在查询{group}组").send()
|
145
|
-
out: List[OutServer] = await
|
150
|
+
out: List[OutServer] = await server_find(command=group, is_img=False) # type: ignore
|
146
151
|
out_msg = "未找到玩家"
|
147
152
|
for one in out:
|
148
153
|
for player in one["player"]:
|
149
154
|
if name in player.name:
|
150
155
|
out_msg = await get_ip_server(f"{one['host']}:{one['port']}")
|
156
|
+
if config.l4_connect and isinstance(out_msg, bytes):
|
157
|
+
out_msg = UniMessage.image(raw=out_msg) + UniMessage.text(
|
158
|
+
f"\nconnect {one['host']}:{one['port']}",
|
159
|
+
)
|
160
|
+
else:
|
161
|
+
out_msg = UniMessage.text(out_msg)
|
151
162
|
|
152
163
|
return await out_msg_out(out_msg)
|
153
164
|
|
@@ -161,7 +172,13 @@ async def _():
|
|
161
172
|
async def _(args: Message = CommandArg()):
|
162
173
|
ip: Optional[str] = args.extract_plain_text()
|
163
174
|
if ip is not None:
|
164
|
-
|
175
|
+
host, port = split_maohao(ip)
|
176
|
+
await out_msg_out(
|
177
|
+
await get_ip_server(ip),
|
178
|
+
is_connect=config.l4_connect,
|
179
|
+
host=host,
|
180
|
+
port=port,
|
181
|
+
)
|
165
182
|
|
166
183
|
|
167
184
|
@l4_reload.handle()
|
@@ -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.9"
|
14
14
|
TEXT_PATH = Path(__file__).parent / "texture2d"
|
15
15
|
HELP_DATA = Path(__file__).parent / "Help.json"
|
16
16
|
|
@@ -152,20 +152,26 @@ async def text2pic(text: str, max_size: int = 800, font_size: int = 24):
|
|
152
152
|
if text.endswith("\n"):
|
153
153
|
text = text[:-1]
|
154
154
|
|
155
|
+
# 更准确的高度计算
|
156
|
+
line_count = text.count("\n") + 1
|
157
|
+
line_height = int(font_size * 1.2) # 每行高度,包含行间距
|
158
|
+
estimated_height = line_count * line_height + 80 # 加上上下边距
|
159
|
+
|
155
160
|
img = Image.new(
|
156
161
|
"RGB",
|
157
|
-
(max_size,
|
162
|
+
(max_size, estimated_height),
|
158
163
|
(255, 255, 255),
|
159
164
|
)
|
160
165
|
img_draw = ImageDraw.ImageDraw(img)
|
161
166
|
y = draw_center_text_by_line(
|
162
167
|
img_draw,
|
163
|
-
(50,
|
168
|
+
(50, 30),
|
164
169
|
text,
|
165
170
|
core_font(font_size),
|
166
171
|
"black",
|
167
172
|
max_size - 80,
|
168
173
|
True, # noqa: FBT003
|
169
174
|
)
|
170
|
-
|
175
|
+
# 裁剪时留一些余量
|
176
|
+
img = img.crop((0, 0, max_size, int(y + 55)))
|
171
177
|
return await convert_img(img)
|
@@ -45,7 +45,15 @@ else:
|
|
45
45
|
|
46
46
|
@search_map.handle()
|
47
47
|
async def _():
|
48
|
-
|
48
|
+
try:
|
49
|
+
supath = local_path[map_index] / "addons"
|
50
|
+
except IndexError:
|
51
|
+
logger.warning(
|
52
|
+
"未填写本地服务器路径,如果想要使用本地服务器功能,请填写本地服务器路径",
|
53
|
+
)
|
54
|
+
await UniMessage.text(
|
55
|
+
"未填写本地服务器路径,如果想要使用本地服务器功能,请填写本地服务器路径",
|
56
|
+
).finish()
|
49
57
|
vpk_list: list[str] = []
|
50
58
|
if supath.is_dir():
|
51
59
|
for sudir in supath.iterdir():
|
@@ -54,6 +62,27 @@ else:
|
|
54
62
|
vpk_list.append(sudir.name)
|
55
63
|
if not vpk_list:
|
56
64
|
await UniMessage.text("未找到可用的VPK文件").finish()
|
65
|
+
|
66
|
+
# 添加排序逻辑(数字升序)
|
67
|
+
def sort_key(filename: str):
|
68
|
+
# 提取文件名开头的数字(如果有)
|
69
|
+
num_part = ""
|
70
|
+
for char in filename:
|
71
|
+
if char.isdigit():
|
72
|
+
num_part += char
|
73
|
+
elif num_part: # 遇到非数字且已经有数字部分时停止
|
74
|
+
break
|
75
|
+
|
76
|
+
# 返回一个元组作为排序依据:(数字值, 整个文件名)
|
77
|
+
# 使用正数表示升序,没有数字的用无穷大排在最后
|
78
|
+
return (
|
79
|
+
int(num_part) if num_part else float("inf"),
|
80
|
+
filename,
|
81
|
+
)
|
82
|
+
|
83
|
+
# 按数字升序,然后按字母和中文排序
|
84
|
+
vpk_list.sort(key=sort_key)
|
85
|
+
|
57
86
|
out_msg = "\n".join(
|
58
87
|
f"{index + 1}、{line}" for index, line in enumerate(vpk_list)
|
59
88
|
)
|
@@ -30,32 +30,32 @@ ALLHOST: Dict[str, List[NserverOut]] = {}
|
|
30
30
|
COMMAND = set()
|
31
31
|
|
32
32
|
|
33
|
-
async def get_all_server_detail():
|
33
|
+
async def get_all_server_detail() -> str:
|
34
34
|
"""
|
35
35
|
获取所有服务器的详细信息。
|
36
36
|
|
37
|
-
Args:
|
38
|
-
无
|
39
|
-
|
40
37
|
Returns:
|
41
38
|
str: 包含所有服务器详细信息的字符串。
|
42
|
-
|
43
39
|
"""
|
44
40
|
out_list: List[AllServer] = []
|
45
41
|
for group in ALLHOST:
|
46
42
|
msg_list = await get_group_detail(group)
|
47
|
-
if msg_list
|
43
|
+
if not msg_list:
|
48
44
|
continue
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
if msg["server"].max_players != 0
|
56
|
-
|
57
|
-
|
58
|
-
|
45
|
+
|
46
|
+
active_server = sum(1 for msg in msg_list if msg["server"].max_players != 0)
|
47
|
+
max_server = len(msg_list)
|
48
|
+
active_player = sum(
|
49
|
+
msg["server"].player_count
|
50
|
+
for msg in msg_list
|
51
|
+
if msg["server"].max_players != 0
|
52
|
+
)
|
53
|
+
max_player = sum(
|
54
|
+
msg["server"].max_players
|
55
|
+
for msg in msg_list
|
56
|
+
if msg["server"].max_players != 0
|
57
|
+
)
|
58
|
+
|
59
59
|
data = {
|
60
60
|
"command": group,
|
61
61
|
"active_server": active_server,
|
@@ -65,14 +65,12 @@ async def get_all_server_detail():
|
|
65
65
|
}
|
66
66
|
out_list.append(cast(AllServer, data))
|
67
67
|
|
68
|
-
#
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
continue
|
75
|
-
return out_msg
|
68
|
+
# 输出服务器信息文本
|
69
|
+
return "\n".join(
|
70
|
+
f"{one['command']} | 服务器{one['active_server']}/{one['max_server']} | 玩家{one['active_player']}/{one['max_player']}"
|
71
|
+
for one in out_list
|
72
|
+
if one["max_player"]
|
73
|
+
)
|
76
74
|
|
77
75
|
|
78
76
|
async def get_server_detail(
|
@@ -87,13 +85,10 @@ async def get_server_detail(
|
|
87
85
|
command (str): 服务器组名。
|
88
86
|
_id (Optional[str], optional): 服务器ID。默认为None。
|
89
87
|
is_img (bool, optional): 是否返回图片格式的信息。默认为True。
|
90
|
-
return_host_port (bool, optional): 是否返回host和port值。默认为False。
|
91
88
|
|
92
89
|
Returns:
|
93
|
-
Union[
|
94
|
-
|
95
|
-
否则返回服务器详细信息(图片格式返回bytes,文本格式返回str);
|
96
|
-
未找到服务器组返回None。
|
90
|
+
Union[UniMessage, None]:
|
91
|
+
返回服务器详细信息(图片或文本格式),未找到服务器组或服务器时返回None。
|
97
92
|
"""
|
98
93
|
server_json = _get_server_json(command, ALLHOST)
|
99
94
|
logger.info(server_json)
|
@@ -101,7 +96,7 @@ async def get_server_detail(
|
|
101
96
|
logger.warning("未找到这个组")
|
102
97
|
return None
|
103
98
|
|
104
|
-
#
|
99
|
+
# 输出组服务器信息
|
105
100
|
if _id is None:
|
106
101
|
return await _handle_group_info(server_json, command, is_img)
|
107
102
|
|
@@ -124,7 +119,7 @@ async def get_group_detail(
|
|
124
119
|
command: str,
|
125
120
|
):
|
126
121
|
server_json = _get_server_json(command, ALLHOST)
|
127
|
-
logger.
|
122
|
+
logger.debug(server_json)
|
128
123
|
if server_json is None:
|
129
124
|
logger.warning("未找到这个组")
|
130
125
|
return None
|
@@ -175,7 +170,7 @@ def reload_ip():
|
|
175
170
|
async def tj_request(command: str = "云", tj="tj"):
|
176
171
|
map_type = "普通药役"
|
177
172
|
server_json = ALLHOST.get(command)
|
178
|
-
logger.
|
173
|
+
logger.debug(server_json)
|
179
174
|
if server_json is None:
|
180
175
|
logger.warning("未找到这个组")
|
181
176
|
return None
|
@@ -191,8 +186,9 @@ async def tj_request(command: str = "云", tj="tj"):
|
|
191
186
|
logger.warning("没有找到符合条件的服务器")
|
192
187
|
return "没有符合条件的服务器"
|
193
188
|
|
189
|
+
server_list_str = [f"{ip['host']}:{ip['port']}" for ip in right_ip]
|
194
190
|
logger.info(
|
195
|
-
f"符合条件的服务器列表: {
|
191
|
+
f"符合条件的服务器列表: {server_list_str}",
|
196
192
|
)
|
197
193
|
s = random.choice(right_ip)
|
198
194
|
logger.info(f"最终选择的服务器: {s['host']}:{s['port']}")
|
@@ -213,3 +209,33 @@ async def tj_request(command: str = "云", tj="tj"):
|
|
213
209
|
except Exception as e:
|
214
210
|
logger.error(f"tj_request error: {e}")
|
215
211
|
return "获取服务器信息时出错"
|
212
|
+
|
213
|
+
|
214
|
+
async def server_find(
|
215
|
+
command: str = "云",
|
216
|
+
_id: Optional[str] = None,
|
217
|
+
is_img: bool = True,
|
218
|
+
):
|
219
|
+
server_json = _get_server_json(command, ALLHOST)
|
220
|
+
logger.debug(server_json)
|
221
|
+
if server_json is None:
|
222
|
+
logger.warning("未找到这个组")
|
223
|
+
return None
|
224
|
+
|
225
|
+
# 输出组服务器信息
|
226
|
+
if _id is None:
|
227
|
+
return await _handle_group_info(server_json, command, is_img)
|
228
|
+
|
229
|
+
_ip = await get_single_server_info(server_json, _id)
|
230
|
+
if _ip is None:
|
231
|
+
logger.warning("未找到这个服务器")
|
232
|
+
return None
|
233
|
+
|
234
|
+
out_msg = await _handle_single_server(server_json, _id, is_img)
|
235
|
+
if isinstance(out_msg, bytes):
|
236
|
+
return UniMessage.image(raw=out_msg) + UniMessage.text(
|
237
|
+
f"connect {_ip[0]}:{_ip[1]}",
|
238
|
+
)
|
239
|
+
if isinstance(out_msg, str):
|
240
|
+
return UniMessage.text(out_msg)
|
241
|
+
return None
|
@@ -1,5 +1,3 @@
|
|
1
|
-
import asyncio
|
2
|
-
|
3
1
|
# from logging import log
|
4
2
|
import io
|
5
3
|
from pathlib import Path
|
@@ -15,9 +13,9 @@ from ..utils.api.request import L4API
|
|
15
13
|
|
16
14
|
async def draw_one_ip(host: str, port: int, is_img: bool = config.l4_image):
|
17
15
|
"""输出单个ip"""
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
ser_list = await L4API.a2s_info([(host, port)], is_player=True)
|
17
|
+
if not ser_list or ser_list[0][0].max_players == 0:
|
18
|
+
# except asyncio.exceptions.TimeoutError:
|
21
19
|
return "服务器无响应"
|
22
20
|
one_server = ser_list[0][0]
|
23
21
|
one_player = ser_list[0][1]
|
@@ -40,15 +38,10 @@ async def draw_one_ip(host: str, port: int, is_img: bool = config.l4_image):
|
|
40
38
|
soc = "[{:>{}}]".format(player.score, max_score_len)
|
41
39
|
chines_dur = await convert_duration(player.duration)
|
42
40
|
dur = "{:^{}}".format(chines_dur, max_duration_len)
|
43
|
-
|
44
|
-
if name_leg > 2:
|
45
|
-
xing = ":)" * (name_leg - 2)
|
46
|
-
name = f"{player.name[0]}{xing}{player.name[-1]}"
|
47
|
-
else:
|
48
|
-
name = player.name
|
41
|
+
name = player.name
|
49
42
|
player_msg += f"{soc} | {dur} | {name} \n"
|
50
43
|
else:
|
51
|
-
player_msg = "
|
44
|
+
player_msg = "服务器感觉很安静啊\n"
|
52
45
|
return player_msg
|
53
46
|
|
54
47
|
def build_server_message(server, player_info: str) -> str:
|
@@ -59,13 +52,35 @@ async def draw_one_ip(host: str, port: int, is_img: bool = config.l4_image):
|
|
59
52
|
Returns:
|
60
53
|
完整的服务器信息字符串
|
61
54
|
"""
|
55
|
+
|
56
|
+
# 处理服务器类型显示
|
57
|
+
type_map = {
|
58
|
+
"d": "Dedicated",
|
59
|
+
"l": "Listen",
|
60
|
+
}
|
61
|
+
platform_map = {
|
62
|
+
"w": "Windows",
|
63
|
+
"l": "Linux",
|
64
|
+
}
|
65
|
+
# 解析原始数据 (例如 "d(w)" -> type='d', platform='w')
|
66
|
+
server_type = server.server_type[0] if server.server_type else "d"
|
67
|
+
platform = server.platform[0] if server.platform else "w"
|
68
|
+
|
69
|
+
# 处理VAC状态显示
|
70
|
+
vac_status = "启用" if server.vac_enabled else "禁用"
|
71
|
+
# 处理密码状态显示
|
72
|
+
pw_status = "是" if server.password_protected else "否"
|
73
|
+
|
62
74
|
msg = f"""-{server.server_name}-
|
63
75
|
游戏: {server.folder}
|
64
76
|
地图: {server.map_name}
|
65
|
-
人数: {server.player_count}/{server.max_players}"""
|
77
|
+
人数: {server.player_count} / {server.max_players}"""
|
66
78
|
if server.ping is not None:
|
67
79
|
msg += f"""
|
68
|
-
|
80
|
+
延迟: {server.ping * 1000:.0f} ms
|
81
|
+
类型: {type_map.get(server_type, '未知')} ({platform_map.get(platform, '未知')})
|
82
|
+
VAC : {vac_status}
|
83
|
+
密码: {pw_status}\n
|
69
84
|
{player_info}"""
|
70
85
|
if config.l4_show_ip:
|
71
86
|
msg += f"""
|
@@ -112,7 +127,7 @@ connect {host}:{port}"""
|
|
112
127
|
|
113
128
|
# 计算图片尺寸
|
114
129
|
margin = 20
|
115
|
-
line_spacing =
|
130
|
+
line_spacing = 7
|
116
131
|
img_width = max(title_width, content_width) + 2 * margin
|
117
132
|
content_lines_count = len(content.split("\n")) if content else 0
|
118
133
|
img_height = max(
|
@@ -141,13 +156,87 @@ connect {host}:{port}"""
|
|
141
156
|
if content:
|
142
157
|
content_x = margin
|
143
158
|
content_y = title_y + title_height + margin
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
159
|
+
|
160
|
+
# 定义不同参数值的颜色(冒号后的内容)
|
161
|
+
value_colors = {
|
162
|
+
"游戏: ": (200, 180, 255), # 淡紫
|
163
|
+
"地图: ": (166, 202, 253), # 淡蓝
|
164
|
+
"人数: ": (100, 255, 100), # 绿色
|
165
|
+
"延迟: ": (100, 255, 100), # 绿色
|
166
|
+
"类型: ": (180, 220, 255), # 淡蓝
|
167
|
+
"密码: ": (255, 255, 255), # 白色
|
168
|
+
# connect不修改,保持原逻辑
|
169
|
+
}
|
170
|
+
|
171
|
+
# 按行绘制内容
|
172
|
+
current_y = content_y
|
173
|
+
for line in content_lines:
|
174
|
+
# 检查是否是参数行
|
175
|
+
colored = False
|
176
|
+
for prefix, color in value_colors.items():
|
177
|
+
if line.startswith(prefix):
|
178
|
+
# 绘制完整参数名(白色)
|
179
|
+
prefix_part = prefix
|
180
|
+
prefix_width = (
|
181
|
+
font.getbbox(prefix_part)[2]
|
182
|
+
- font.getbbox(prefix_part)[0]
|
183
|
+
)
|
184
|
+
draw.text(
|
185
|
+
(content_x, current_y),
|
186
|
+
prefix_part,
|
187
|
+
font=font,
|
188
|
+
fill=(255, 255, 255),
|
189
|
+
)
|
190
|
+
|
191
|
+
# 绘制参数值(带颜色)
|
192
|
+
value_part = line[len(prefix) :].strip()
|
193
|
+
draw.text(
|
194
|
+
(content_x + prefix_width, current_y),
|
195
|
+
value_part,
|
196
|
+
font=font,
|
197
|
+
fill=color,
|
198
|
+
)
|
199
|
+
|
200
|
+
colored = True
|
201
|
+
break
|
202
|
+
# 特殊处理VAC行
|
203
|
+
if not colored and line.startswith("VAC :"):
|
204
|
+
prefix = "VAC : "
|
205
|
+
prefix_width = (
|
206
|
+
font.getbbox(prefix)[2] - font.getbbox(prefix)[0]
|
207
|
+
)
|
208
|
+
draw.text(
|
209
|
+
(content_x, current_y),
|
210
|
+
prefix,
|
211
|
+
font=font,
|
212
|
+
fill=(255, 255, 255),
|
213
|
+
)
|
214
|
+
|
215
|
+
value_part = line[len(prefix) :].strip()
|
216
|
+
vac_color = (
|
217
|
+
(70, 209, 110)
|
218
|
+
if value_part == "启用"
|
219
|
+
else (255, 90, 90)
|
220
|
+
) # 启用绿/禁用红
|
221
|
+
draw.text(
|
222
|
+
(content_x + prefix_width, current_y),
|
223
|
+
value_part,
|
224
|
+
font=font,
|
225
|
+
fill=vac_color,
|
226
|
+
)
|
227
|
+
|
228
|
+
colored = True
|
229
|
+
|
230
|
+
# 普通行(玩家信息)和connect保持原样
|
231
|
+
if not colored:
|
232
|
+
draw.text(
|
233
|
+
(content_x, current_y),
|
234
|
+
line,
|
235
|
+
font=font,
|
236
|
+
fill=(255, 255, 255),
|
237
|
+
)
|
238
|
+
|
239
|
+
current_y += line_height + line_spacing
|
151
240
|
|
152
241
|
return img
|
153
242
|
except Exception as e:
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Dict, List, Optional, Tuple, Union
|
1
|
+
from typing import Dict, List, Optional, Tuple, Union
|
2
2
|
|
3
3
|
from nonebot.log import logger
|
4
4
|
|
@@ -34,7 +34,7 @@ async def _handle_group_info(
|
|
34
34
|
server_json: list,
|
35
35
|
command: str,
|
36
36
|
is_img: bool,
|
37
|
-
)
|
37
|
+
):
|
38
38
|
"""
|
39
39
|
处理服务器组信息请求
|
40
40
|
|
@@ -44,13 +44,13 @@ async def _handle_group_info(
|
|
44
44
|
is_img (bool): 是否返回图片格式
|
45
45
|
|
46
46
|
Returns:
|
47
|
-
Union[bytes,
|
47
|
+
Union[bytes, list, None]: 图片格式返回bytes,否则返回服务器列表
|
48
48
|
"""
|
49
49
|
logger.info(f"正在请求组服务器信息 {command}")
|
50
50
|
server_dict = await get_much_server(server_json, command)
|
51
51
|
if is_img:
|
52
52
|
return await msg_to_image(server_dict)
|
53
|
-
return
|
53
|
+
return server_dict
|
54
54
|
|
55
55
|
|
56
56
|
async def get_single_server_info(
|
@@ -95,10 +95,7 @@ async def _handle_single_server(
|
|
95
95
|
return None
|
96
96
|
|
97
97
|
host, port = server_info
|
98
|
-
|
99
|
-
if is_img:
|
100
|
-
return cast(bytes, out_msg)
|
101
|
-
return out_msg
|
98
|
+
return await draw_one_ip(host, port, is_img=is_img)
|
102
99
|
|
103
100
|
|
104
101
|
async def _filter_servers(
|
@@ -313,98 +313,101 @@ class L4D2Api:
|
|
313
313
|
)
|
314
314
|
if tbody is None:
|
315
315
|
return None
|
316
|
-
|
316
|
+
|
317
|
+
def get_table_dict(table, keys):
|
318
|
+
trs = table.select("tr")
|
319
|
+
return {
|
320
|
+
key: trs[i].select("td")[1].text.strip() for i, key in enumerate(keys)
|
321
|
+
}
|
322
|
+
|
323
|
+
kill_tag = cast(Tag, tbody).find(
|
317
324
|
"div",
|
318
325
|
class_="card-body worldmap d-flex flex-column justify-content-center text-center",
|
319
326
|
)
|
320
327
|
|
321
|
-
tbody_tags =
|
322
|
-
|
323
|
-
|
324
|
-
|
328
|
+
tbody_tags = []
|
329
|
+
if isinstance(tbody, Tag):
|
330
|
+
tbody_tags = tbody.find_all(
|
331
|
+
"table",
|
332
|
+
class_="table content-table-noborder text-left",
|
333
|
+
)
|
334
|
+
if len(tbody_tags) < 6:
|
335
|
+
return None
|
336
|
+
|
337
|
+
info_keys = ["name", "avatar", "steamid", "playtime", "lasttime"]
|
338
|
+
detail_keys = [
|
339
|
+
"rank",
|
340
|
+
"source",
|
341
|
+
"avg_source",
|
342
|
+
"kills",
|
343
|
+
"kills_people",
|
344
|
+
"headshots",
|
345
|
+
"avg_headshots",
|
346
|
+
"map_play",
|
347
|
+
]
|
348
|
+
error_keys = [
|
349
|
+
"mistake_shout",
|
350
|
+
"kill_friend",
|
351
|
+
"down_friend",
|
352
|
+
"abandon_friend",
|
353
|
+
"put_into",
|
354
|
+
"agitate_witch",
|
355
|
+
]
|
356
|
+
inf_avg_keys = [
|
357
|
+
"avg_smoker",
|
358
|
+
"avg_boomer",
|
359
|
+
"avg_hunter",
|
360
|
+
"avg_charger",
|
361
|
+
"avg_spitter",
|
362
|
+
"avg_jockey",
|
363
|
+
"avg_tank",
|
364
|
+
]
|
365
|
+
sur_keys = [
|
366
|
+
"map_clear",
|
367
|
+
"prefect_into",
|
368
|
+
"get_oil",
|
369
|
+
"ammo_arrange",
|
370
|
+
"adrenaline_give",
|
371
|
+
"pills_give",
|
372
|
+
"first_aid_give",
|
373
|
+
"friend_up",
|
374
|
+
"diss_friend",
|
375
|
+
"save_friend",
|
376
|
+
"protect_friend",
|
377
|
+
"pro_from_smoker",
|
378
|
+
"pro_from_hunter",
|
379
|
+
"pro_from_charger",
|
380
|
+
"pro_from_jockey",
|
381
|
+
"melee_charge",
|
382
|
+
"tank_kill",
|
383
|
+
"witch_instantly_kill",
|
384
|
+
]
|
385
|
+
inf_keys = [
|
386
|
+
"sur_ace",
|
387
|
+
"sur_down",
|
388
|
+
"boommer_hit",
|
389
|
+
"hunter_prefect",
|
390
|
+
"hunter_success",
|
391
|
+
"tank_damage",
|
392
|
+
"charger_multiple",
|
393
|
+
]
|
394
|
+
|
395
|
+
info_dict = get_table_dict(tbody_tags[0], info_keys)
|
396
|
+
detail_dict = get_table_dict(tbody_tags[1], detail_keys)
|
397
|
+
error_dict = get_table_dict(tbody_tags[2], error_keys)
|
398
|
+
inf_avg_dict = get_table_dict(tbody_tags[3], inf_avg_keys)
|
399
|
+
sur_dict = get_table_dict(tbody_tags[4], sur_keys)
|
400
|
+
inf_dict = get_table_dict(tbody_tags[5], inf_keys)
|
325
401
|
|
326
|
-
info_tag = tbody_tags[0]
|
327
|
-
detail_tag = tbody_tags[1]
|
328
|
-
error_tag = tbody_tags[2]
|
329
|
-
inf_avg_tag = tbody_tags[3]
|
330
|
-
sur_tag = tbody_tags[4]
|
331
|
-
inf_tag = tbody_tags[5]
|
332
|
-
|
333
|
-
info_tr = info_tag.select("tr")
|
334
|
-
info_dict = {
|
335
|
-
"name": info_tr[0].select("td")[1].text.strip(),
|
336
|
-
"avatar": info_tr[1].select("td")[1].text.strip(),
|
337
|
-
"steamid": info_tr[2].select("td")[1].text.strip(),
|
338
|
-
"playtime": info_tr[3].select("td")[1].text.strip(),
|
339
|
-
"lasttime": info_tr[4].select("td")[1].text.strip(),
|
340
|
-
}
|
341
|
-
detail_tag = {
|
342
|
-
"rank": detail_tag.select("tr")[0].select("td")[1].text.strip(),
|
343
|
-
"source": detail_tag.select("tr")[1].select("td")[1].text.strip(),
|
344
|
-
"avg_source": detail_tag.select("tr")[2].select("td")[1].text.strip(),
|
345
|
-
"kills": detail_tag.select("tr")[3].select("td")[1].text.strip(),
|
346
|
-
"kills_people": detail_tag.select("tr")[4].select("td")[1].text.strip(),
|
347
|
-
"headshots": detail_tag.select("tr")[5].select("td")[1].text.strip(),
|
348
|
-
"avg_headshots": detail_tag.select("tr")[6].select("td")[1].text.strip(),
|
349
|
-
"map_play": detail_tag.select("tr")[7].select("td")[1].text.strip(),
|
350
|
-
}
|
351
|
-
error_tag = {
|
352
|
-
"mistake_shout": error_tag.select("tr")[0].select("td")[1].text.strip(),
|
353
|
-
"kill_friend": error_tag.select("tr")[1].select("td")[1].text.strip(),
|
354
|
-
"down_friend": error_tag.select("tr")[2].select("td")[1].text.strip(),
|
355
|
-
"abandon_friend": error_tag.select("tr")[3].select("td")[1].text.strip(),
|
356
|
-
"put_into": error_tag.select("tr")[4].select("td")[1].text.strip(),
|
357
|
-
"agitate_witch": error_tag.select("tr")[5].select("td")[1].text.strip(),
|
358
|
-
}
|
359
|
-
inf_avg_dict = {
|
360
|
-
"avg_smoker": inf_avg_tag.select("tr")[0].select("td")[1].text.strip(),
|
361
|
-
"avg_boomer": inf_avg_tag.select("tr")[1].select("td")[1].text.strip(),
|
362
|
-
"avg_hunter": inf_avg_tag.select("tr")[2].select("td")[1].text.strip(),
|
363
|
-
"avg_charger": inf_avg_tag.select("tr")[3].select("td")[1].text.strip(),
|
364
|
-
"avg_spitter": inf_avg_tag.select("tr")[4].select("td")[1].text.strip(),
|
365
|
-
"avg_jockey": inf_avg_tag.select("tr")[5].select("td")[1].text.strip(),
|
366
|
-
"avg_tank": inf_avg_tag.select("tr")[6].select("td")[1].text.strip(),
|
367
|
-
}
|
368
|
-
sur_dict = {
|
369
|
-
"map_clear": sur_tag.select("tr")[0].select("td")[1].text.strip(),
|
370
|
-
"prefect_into": sur_tag.select("tr")[1].select("td")[1].text.strip(),
|
371
|
-
"get_oil": sur_tag.select("tr")[2].select("td")[1].text.strip(),
|
372
|
-
"ammo_arrange": sur_tag.select("tr")[3].select("td")[1].text.strip(),
|
373
|
-
"adrenaline_give": sur_tag.select("tr")[4].select("td")[1].text.strip(),
|
374
|
-
"pills_give": sur_tag.select("tr")[5].select("td")[1].text.strip(),
|
375
|
-
"first_aid_give": sur_tag.select("tr")[6].select("td")[1].text.strip(),
|
376
|
-
"friend_up": sur_tag.select("tr")[7].select("td")[1].text.strip(),
|
377
|
-
"diss_friend": sur_tag.select("tr")[8].select("td")[1].text.strip(),
|
378
|
-
"save_friend": sur_tag.select("tr")[9].select("td")[1].text.strip(),
|
379
|
-
"protect_friend": sur_tag.select("tr")[10].select("td")[1].text.strip(),
|
380
|
-
"pro_from_smoker": sur_tag.select("tr")[11].select("td")[1].text.strip(),
|
381
|
-
"pro_from_hunter": sur_tag.select("tr")[12].select("td")[1].text.strip(),
|
382
|
-
"pro_from_charger": sur_tag.select("tr")[13].select("td")[1].text.strip(),
|
383
|
-
"pro_from_jockey": sur_tag.select("tr")[14].select("td")[1].text.strip(),
|
384
|
-
"melee_charge": sur_tag.select("tr")[15].select("td")[1].text.strip(),
|
385
|
-
"tank_kill": sur_tag.select("tr")[16].select("td")[1].text.strip(),
|
386
|
-
"witch_instantly_kill": sur_tag.select("tr")[17]
|
387
|
-
.select("td")[1]
|
388
|
-
.text.strip(),
|
389
|
-
}
|
390
|
-
inf_dict = {
|
391
|
-
"sur_ace": inf_tag.select("tr")[0].select("td")[1].text.strip(),
|
392
|
-
"sur_down": inf_tag.select("tr")[1].select("td")[1].text.strip(),
|
393
|
-
"boommer_hit": inf_tag.select("tr")[2].select("td")[1].text.strip(),
|
394
|
-
"hunter_prefect": inf_tag.select("tr")[3].select("td")[1].text.strip(),
|
395
|
-
"hunter_success": inf_tag.select("tr")[4].select("td")[1].text.strip(),
|
396
|
-
"tank_damage": inf_tag.select("tr")[5].select("td")[1].text.strip(),
|
397
|
-
"charger_multiple": inf_tag.select("tr")[6].select("td")[1].text.strip(),
|
398
|
-
}
|
399
402
|
info_dict = cast(AnnePlayerInfo, info_dict)
|
400
|
-
detail_dict = cast(AnnePlayerDetail,
|
401
|
-
error_dict = cast(AnnePlayerError,
|
403
|
+
detail_dict = cast(AnnePlayerDetail, detail_dict)
|
404
|
+
error_dict = cast(AnnePlayerError, error_dict)
|
402
405
|
inf_avg_dict = cast(AnnePlayerInfAvg, inf_avg_dict)
|
403
406
|
sur_dict = cast(AnnePlayerSur, sur_dict)
|
404
407
|
inf_dict = cast(AnnePlayerInf, inf_dict)
|
405
408
|
|
406
409
|
out_dict = {
|
407
|
-
"kill_msg": kill_tag.text if kill_tag
|
410
|
+
"kill_msg": kill_tag.text.strip() if kill_tag else "",
|
408
411
|
"info": info_dict,
|
409
412
|
"detail": detail_dict,
|
410
413
|
"inf_avg": inf_avg_dict,
|
@@ -24,7 +24,7 @@ async def out_msg_out(
|
|
24
24
|
await UniMessage.text(msg).finish()
|
25
25
|
if is_connect:
|
26
26
|
out = UniMessage.image(raw=msg) + UniMessage.text(
|
27
|
-
f"
|
27
|
+
f"connect: {host}:{port}",
|
28
28
|
)
|
29
29
|
return await out.finish()
|
30
30
|
return await UniMessage.image(raw=msg).finish()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|