nonebot-plugin-l4d2-server 1.0.1__tar.gz → 1.0.2__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.1 → nonebot_plugin_l4d2_server-1.0.2}/PKG-INFO +5 -2
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/__main__.py +37 -25
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/__init__.py +1 -1
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_local/__init__.py +3 -1
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_request/__init__.py +26 -22
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_request/draw_msg.py +1 -1
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/utils/api/request.py +33 -9
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/pyproject.toml +6 -3
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/LICENSE +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/README.md +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/__init__.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/config.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/data/font/loli.ttf +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_anne/__init__.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_anne/ranne.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/Help.json +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/draw.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//344/273/213/347/273/215.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//344/273/273/345/212/241.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//344/277/241/346/201/257.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//345/205/254/345/221/212.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//345/210/200/345/211/221.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//345/210/207/346/215/242.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//345/210/240/351/231/244.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//345/210/267/346/226/260.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//345/215/241/347/273/204.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//345/223/252/351/207/214.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//345/234/260/345/233/276.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//345/257/274/345/205/245.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//345/257/274/345/207/272.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//345/275/261.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//346/213/274/345/233/276.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//346/216/242/347/264/242.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//346/216/250/351/200/201.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//346/224/266/351/233/206.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//346/224/273/347/225/245.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//346/233/264/346/226/260.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//346/235/220/346/226/231.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//346/237/245/350/257/242.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//346/240/241/351/252/214.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//346/257/217/346/234/210.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//346/267/261/346/270/212.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//346/267/273/345/212/240.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//346/270/205/351/231/244.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//347/212/266/346/200/201.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//347/255/276/345/210/260.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//347/273/221/345/256/232.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//350/241/250.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//350/241/250/346/203/205.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//350/247/222/350/211/262.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//350/256/260/345/275/225.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//351/205/215/347/275/256.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/icon//351/207/215/345/220/257.png" +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/texture2d/badge.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/texture2d/banner.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/texture2d/bg.jpg +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/texture2d/button.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_help/texture2d/icon.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/__init__.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/anne_pil.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/convert.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/download.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/html_img.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/image_tools.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/anne/anne.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/anne/back.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/anne/back1.jpg +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/anne/group_ip.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/anne/ip.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/head/head.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/header/logo.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/header/player1.jpg +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/template/Bocchi_The_Rock.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/template/Bocchi_The_Rock.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/template/HYPixel11pxU-2.ttf +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/template/Pixel.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/template/Pixel.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/template/Rainbow.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/template/Rainbow.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/template/Tutumianhuatang-Bold-2.ttf +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/template/bilibili.svg +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/template/fingerprint.svg +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/template/github.svg +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/template/l.svg +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/template/m.svg +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/template/normal.html +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/template/vac.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/template/vac_white.png +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/template/vue.css +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/img/template/w.svg +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/model.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_image/vtfs.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_local/file.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/l4_request/utils.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/utils/api/api.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/utils/api/models.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/nonebot_plugin_l4d2_server/utils/database/models.py +0 -0
- {nonebot_plugin_l4d2_server-1.0.1 → nonebot_plugin_l4d2_server-1.0.2}/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.
|
3
|
+
Version: 1.0.2
|
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,12 +25,15 @@ Requires-Dist: jinja2>=3.0.0
|
|
25
25
|
Requires-Dist: srctools>=2.3.9
|
26
26
|
Requires-Dist: httpx<0.24.1,>=0.22.0
|
27
27
|
Requires-Dist: msgspec>=0.18.0
|
28
|
-
Requires-Dist: python-a2s>=1.
|
28
|
+
Requires-Dist: python-a2s>=1.4.1
|
29
29
|
Requires-Dist: ujson>=5.10.0
|
30
30
|
Requires-Dist: lxml>=5.2.2
|
31
31
|
Requires-Dist: rcon>=2.1.0
|
32
32
|
Requires-Dist: pillow>9
|
33
33
|
Requires-Dist: beautifulsoup4>=4.12.3
|
34
|
+
Requires-Dist: rarfile>=4.2
|
35
|
+
Requires-Dist: pyunpack>=0.3
|
36
|
+
Requires-Dist: aiofiles>=24.1.0
|
34
37
|
Description-Content-Type: text/markdown
|
35
38
|
|
36
39
|
<!-- markdownlint-disable MD026 MD031 MD033 MD036 MD041 MD046 MD051 -->
|
@@ -18,6 +18,7 @@
|
|
18
18
|
from pathlib import Path
|
19
19
|
from typing import TYPE_CHECKING, List, Optional
|
20
20
|
|
21
|
+
import aiofiles
|
21
22
|
import ujson as json
|
22
23
|
from nonebot.adapters import Message
|
23
24
|
from nonebot.log import logger
|
@@ -35,7 +36,7 @@ from .l4_request import (
|
|
35
36
|
get_ip_server,
|
36
37
|
get_server_detail,
|
37
38
|
reload_ip,
|
38
|
-
tj_request
|
39
|
+
tj_request,
|
39
40
|
)
|
40
41
|
from .utils.api.request import L4API
|
41
42
|
|
@@ -54,6 +55,8 @@ l4_find_player = on_command("l4find", aliases={"l4查找"})
|
|
54
55
|
ld_tj = on_command("tj", aliases={"探监"})
|
55
56
|
ld_zl = on_command("zl")
|
56
57
|
ld_kl = on_command("kl")
|
58
|
+
config_path = Path(config.l4_path) / "config.json"
|
59
|
+
|
57
60
|
|
58
61
|
@l4_help.handle()
|
59
62
|
async def _(matcher: Matcher):
|
@@ -149,18 +152,18 @@ async def _(args: Message = CommandArg()):
|
|
149
152
|
logger.info(f"重载{tag}的ip")
|
150
153
|
await L4API.get_sourceban(tag, url)
|
151
154
|
await UniMessage.text("重载ip完成").finish()
|
152
|
-
|
155
|
+
|
153
156
|
|
154
157
|
l4_add_ban = on_command("l4addban", aliases={"l4添加ban"})
|
158
|
+
|
159
|
+
|
155
160
|
@l4_add_ban.handle()
|
156
161
|
async def _(args: Message = CommandArg()):
|
157
162
|
arg = args.extract_plain_text().strip().split(" ")
|
158
|
-
|
163
|
+
|
159
164
|
if len(arg) != 2:
|
160
165
|
await UniMessage.text("请在命令后增加响应指令名和网址").finish()
|
161
|
-
|
162
|
-
config_path = Path(config.l4_path) / "config.json"
|
163
|
-
|
166
|
+
|
164
167
|
if not config_path.is_file():
|
165
168
|
config_data = {}
|
166
169
|
else:
|
@@ -169,61 +172,70 @@ async def _(args: Message = CommandArg()):
|
|
169
172
|
config_data = json.load(f)
|
170
173
|
except (json.JSONDecodeError, FileNotFoundError):
|
171
174
|
config_data = {}
|
172
|
-
|
175
|
+
|
173
176
|
config_data.update({arg[0]: arg[1]})
|
174
|
-
|
177
|
+
|
175
178
|
try:
|
176
179
|
with config_path.open("w") as f:
|
177
180
|
json.dump(config_data, f, ensure_ascii=False, indent=4)
|
178
181
|
except IOError as e:
|
179
182
|
await UniMessage.text(f"文件写入失败: {e}").finish()
|
180
|
-
|
183
|
+
|
181
184
|
await L4API.get_sourceban(arg[0], arg[1])
|
182
185
|
await UniMessage.text(f"添加成功\n组名: {arg[0]}\n网址: {arg[1]}").finish()
|
183
|
-
|
186
|
+
|
184
187
|
|
185
188
|
l4_del_ban = on_command("l4delban", aliases={"l4删除ban", "l4移除ban"})
|
189
|
+
|
190
|
+
|
186
191
|
@l4_del_ban.handle()
|
187
|
-
async def _(args: Message = CommandArg()):
|
192
|
+
async def _(args: Message = CommandArg()):
|
188
193
|
arg = args.extract_plain_text().strip().split(" ")
|
189
|
-
if
|
194
|
+
if len(arg) not in [1, 2]:
|
190
195
|
await UniMessage.text("请在命令后增加响应指令名或者带响应网址").finish()
|
191
196
|
elif len(arg) == 1:
|
192
197
|
if not Path(Path(config.l4_path) / "config.json").is_file():
|
193
198
|
await UniMessage.text("没有添加过组名").finish()
|
194
199
|
else:
|
195
|
-
with (Path(config.l4_path) / "config.json").open(
|
200
|
+
with (Path(config.l4_path) / "config.json").open(
|
201
|
+
"r",
|
202
|
+
encoding="utf-8",
|
203
|
+
) as f:
|
196
204
|
content = f.read().strip()
|
197
|
-
config_data = json.loads(content)
|
205
|
+
config_data = json.loads(content)
|
198
206
|
if arg[0] not in config_data:
|
199
207
|
await UniMessage.text("没有添加过这个组").finish()
|
200
208
|
else:
|
201
209
|
del config_data[arg[0]]
|
202
|
-
|
203
|
-
|
204
|
-
|
210
|
+
async with aiofiles.open(config_path, "w", encoding="utf-8") as f:
|
211
|
+
json.dump(config_data, f, ensure_ascii=False, indent=4)
|
212
|
+
await UniMessage.text(f"删除成功,组名:{arg[0]}").finish()
|
205
213
|
elif len(arg) == 2:
|
206
214
|
if not Path(Path(config.l4_path) / "config.json").is_file():
|
207
215
|
await UniMessage.text("没有添加过组名").finish()
|
208
216
|
else:
|
209
|
-
with (Path(config.l4_path) / "config.json").open(
|
217
|
+
with (Path(config.l4_path) / "config.json").open(
|
218
|
+
"r",
|
219
|
+
encoding="utf-8",
|
220
|
+
) as f:
|
210
221
|
content = f.read().strip()
|
211
222
|
config_datas = json.loads(content)
|
212
223
|
if arg[0] not in config_datas:
|
213
224
|
await UniMessage.text("没有添加过这个组").finish()
|
214
225
|
else:
|
215
226
|
config_datas[arg[0]] = arg[1]
|
216
|
-
with
|
217
|
-
json.dump(config_datas, f,ensure_ascii=False,indent=4)
|
227
|
+
async with aiofiles.open(config_path, "w", encoding="utf-8") as f:
|
228
|
+
json.dump(config_datas, f, ensure_ascii=False, indent=4)
|
218
229
|
await UniMessage.text(f"修改成功,组名:{arg[0]},网址:{arg[1]}").finish()
|
219
|
-
|
220
|
-
|
230
|
+
|
231
|
+
|
221
232
|
@ld_tj.handle()
|
222
233
|
async def _(matcher: Matcher):
|
223
234
|
await matcher.send("正在寻找牢房信息")
|
224
|
-
await matcher.finish(await tj_request("云","tj"))
|
225
|
-
|
235
|
+
await matcher.finish(await tj_request("云", "tj"))
|
236
|
+
|
237
|
+
|
226
238
|
@ld_zl.handle()
|
227
239
|
async def _(matcher: Matcher):
|
228
240
|
await matcher.send("正在寻找牢房信息")
|
229
|
-
await matcher.finish(await tj_request("云","zl"))
|
241
|
+
await matcher.finish(await tj_request("云", "zl"))
|
@@ -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.2"
|
14
14
|
TEXT_PATH = Path(__file__).parent / "texture2d"
|
15
15
|
HELP_DATA = Path(__file__).parent / "Help.json"
|
16
16
|
|
@@ -13,7 +13,9 @@ from .file import updown_l4d2_vpk
|
|
13
13
|
try:
|
14
14
|
vpk_path = config.l4_local[map_index]
|
15
15
|
except IndexError:
|
16
|
-
logger.warning(
|
16
|
+
logger.warning(
|
17
|
+
"未填写本地服务器路径,如果想要使用本地服务器功能,请填写本地服务器路径",
|
18
|
+
)
|
17
19
|
vpk_path = ""
|
18
20
|
|
19
21
|
local_path_list = config.l4_local
|
@@ -2,16 +2,19 @@ import random
|
|
2
2
|
from typing import Dict, List, Optional, cast
|
3
3
|
|
4
4
|
from nonebot.log import logger
|
5
|
+
|
5
6
|
from ..config import server_all_path
|
6
7
|
from ..l4_image import msg_to_image
|
7
8
|
from ..utils.api.models import AllServer, NserverOut, OutServer
|
8
|
-
from ..utils.utils import split_maohao
|
9
|
-
from .draw_msg import draw_one_ip, get_much_server, convert_duration
|
10
9
|
from ..utils.api.request import L4API
|
10
|
+
from ..utils.utils import split_maohao
|
11
|
+
from .draw_msg import convert_duration, draw_one_ip, get_much_server
|
12
|
+
|
11
13
|
try:
|
12
14
|
import ujson as json
|
13
15
|
except ImportError:
|
14
16
|
import json
|
17
|
+
|
15
18
|
from ..config import config
|
16
19
|
|
17
20
|
# 获取全部服务器信息
|
@@ -47,7 +50,10 @@ async def get_all_server_detail():
|
|
47
50
|
# to do作图,先用文字凑合
|
48
51
|
out_msg = ""
|
49
52
|
for one in out_list:
|
50
|
-
|
53
|
+
if one["max_player"]:
|
54
|
+
out_msg += f"{one['command']} | 服务器{one['active_server']}/{one['max_server']} | 玩家{one['active_player']}/{one['max_player']}\n"
|
55
|
+
else:
|
56
|
+
continue
|
51
57
|
return out_msg
|
52
58
|
|
53
59
|
|
@@ -142,12 +148,13 @@ def reload_ip():
|
|
142
148
|
if item.name.endswith("txt"):
|
143
149
|
"""to do"""
|
144
150
|
|
145
|
-
|
151
|
+
|
152
|
+
async def tj_request(command: str = "云", tj="tj"):
|
146
153
|
server_json = ALLHOST.get(command)
|
147
154
|
logger.info(server_json)
|
148
155
|
if server_json is None:
|
149
156
|
logger.warning("未找到这个组")
|
150
|
-
return None
|
157
|
+
return None
|
151
158
|
# 返回单个
|
152
159
|
logger.info("正在anne电信服务器信息")
|
153
160
|
player_msg = ""
|
@@ -156,27 +163,24 @@ async def tj_request(command: str = "云",tj ="tj"):
|
|
156
163
|
ser_list = await L4API.a2s_info([(i["host"], i["port"])], is_player=True)
|
157
164
|
one_server = ser_list[0][0]
|
158
165
|
one_player = ser_list[0][1]
|
159
|
-
|
166
|
+
|
160
167
|
# 判断坐牢条件
|
161
|
-
if tj == "tj":
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
if int(t)*50 < score:
|
171
|
-
right_ip.append(i)
|
172
|
-
if tj == "zl":
|
173
|
-
if "普通药役" in one_server.map_name and len(one_player) <= 4:
|
168
|
+
if tj == "tj" and "普通药役" in one_server.map_name:
|
169
|
+
score: int = 0
|
170
|
+
for index, player in enumerate(one_player, 1):
|
171
|
+
if index > 4:
|
172
|
+
break
|
173
|
+
score += player.score
|
174
|
+
|
175
|
+
t = one_server.map_name.split("[")[-1].split("特")[0]
|
176
|
+
if int(t) * 50 < score:
|
174
177
|
right_ip.append(i)
|
175
|
-
|
176
|
-
|
178
|
+
if tj == "zl" and "普通药役" in one_server.map_name and len(one_player) <= 4:
|
179
|
+
right_ip.append(i)
|
180
|
+
|
177
181
|
if not right_ip:
|
178
182
|
return "没有符合条件的服务器"
|
179
|
-
|
183
|
+
|
180
184
|
s = random.choice(right_ip)
|
181
185
|
ser_list = await L4API.a2s_info([(s["host"], s["port"])], is_player=True)
|
182
186
|
one_server = ser_list[0][0]
|
@@ -31,7 +31,7 @@ async def draw_one_ip(host: str, port: int):
|
|
31
31
|
dur = "{:^{}}".format(chines_dur, max_duration_len)
|
32
32
|
name_leg = len(player.name)
|
33
33
|
if name_leg > 2:
|
34
|
-
xing = "*" * (name_leg - 2)
|
34
|
+
# xing = "*" * (name_leg - 2)
|
35
35
|
name = f"{player.name[0]}xing{player.name[-1]}"
|
36
36
|
else:
|
37
37
|
name = player.name
|
@@ -6,6 +6,7 @@ from pathlib import Path
|
|
6
6
|
from typing import Any, Dict, List, Literal, Optional, Tuple, cast
|
7
7
|
|
8
8
|
import a2s
|
9
|
+
import aiofiles
|
9
10
|
import ujson as js
|
10
11
|
import ujson as json
|
11
12
|
from bs4 import BeautifulSoup
|
@@ -28,6 +29,8 @@ from .models import (
|
|
28
29
|
SourceBansInfo,
|
29
30
|
)
|
30
31
|
|
32
|
+
config_path = Path(config.l4_path) / "config.json"
|
33
|
+
|
31
34
|
|
32
35
|
class L4D2Api:
|
33
36
|
ssl_verify = False
|
@@ -76,11 +79,11 @@ class L4D2Api:
|
|
76
79
|
is_server: bool,
|
77
80
|
is_player: bool,
|
78
81
|
):
|
79
|
-
server: a2s.SourceInfo = a2s.SourceInfo()
|
80
82
|
play: List[a2s.Player] = []
|
81
83
|
if is_server:
|
82
84
|
try:
|
83
|
-
server = await a2s.ainfo(ip)
|
85
|
+
server: a2s.SourceInfo = await a2s.ainfo(ip, timeout=3, encoding="utf8")
|
86
|
+
|
84
87
|
if server is not None:
|
85
88
|
server.steam_id = index
|
86
89
|
|
@@ -89,6 +92,25 @@ class L4D2Api:
|
|
89
92
|
ConnectionRefusedError,
|
90
93
|
socket.gaierror,
|
91
94
|
):
|
95
|
+
server: a2s.SourceInfo = a2s.SourceInfo(
|
96
|
+
protocol=0,
|
97
|
+
server_name="服务器无响应",
|
98
|
+
map_name="无",
|
99
|
+
folder="m",
|
100
|
+
game="L4D2",
|
101
|
+
app_id=114514,
|
102
|
+
steam_id=index,
|
103
|
+
player_count=0,
|
104
|
+
max_players=0,
|
105
|
+
bot_count=0,
|
106
|
+
server_type="w",
|
107
|
+
platform="w",
|
108
|
+
password_protected=False,
|
109
|
+
vac_enabled=False,
|
110
|
+
version="1.0",
|
111
|
+
edf=0,
|
112
|
+
ping=0,
|
113
|
+
)
|
92
114
|
server.steam_id = index
|
93
115
|
server.player_count = 0
|
94
116
|
server.max_players = 0
|
@@ -103,7 +125,7 @@ class L4D2Api:
|
|
103
125
|
ConnectionRefusedError,
|
104
126
|
socket.gaierror,
|
105
127
|
):
|
106
|
-
play = await a2s.aplayers(ip)
|
128
|
+
play = await a2s.aplayers(ip, timeout=3, encoding="utf8")
|
107
129
|
return server, play
|
108
130
|
|
109
131
|
async def _server_request(
|
@@ -158,7 +180,7 @@ class L4D2Api:
|
|
158
180
|
html_content = resp.content
|
159
181
|
return BeautifulSoup(html_content, "lxml")
|
160
182
|
|
161
|
-
async def get_sourceban(self, tag:str = "云", url: str = anne_ban):
|
183
|
+
async def get_sourceban(self, tag: str = "云", url: str = anne_ban):
|
162
184
|
"""从sourceban++获取服务器列表,目前未做名称处理"""
|
163
185
|
if not (url.startswith(("http://", "https://"))):
|
164
186
|
url = "http://" + url # 默认添加 http://
|
@@ -184,23 +206,25 @@ class L4D2Api:
|
|
184
206
|
)
|
185
207
|
|
186
208
|
if not Path(Path(config.l4_path) / "config.json").is_file():
|
187
|
-
with
|
188
|
-
f.write("{}")
|
209
|
+
async with aiofiles.open(config_path, "w", encoding="utf-8") as f:
|
210
|
+
await f.write("{}")
|
189
211
|
with (Path(config.l4_path) / "config.json").open("r", encoding="utf-8") as f:
|
190
212
|
content = f.read().strip()
|
191
213
|
ip_json = json.loads(content)
|
192
214
|
if tag in ip_json:
|
193
215
|
url = ip_json[tag]
|
194
|
-
|
216
|
+
tag_path = Path(Path(config.l4_path) / f"l4d2/{tag}.json")
|
217
|
+
|
218
|
+
async with aiofiles.open(tag_path, "w", encoding="utf-8") as f:
|
195
219
|
print(Path(Path(config.l4_path) / f"l4d2/{tag}.json"))
|
196
220
|
up_data = {}
|
197
221
|
for server in server_list:
|
198
222
|
new_dict = {}
|
199
|
-
new_dict["id"] = int(server.index
|
223
|
+
new_dict["id"] = int(server.index) + 1
|
200
224
|
new_dict["ip"] = server.host + ":" + str(server.port)
|
201
225
|
up_data.update(new_dict)
|
202
226
|
print(up_data)
|
203
|
-
json.dump(up_data, f)
|
227
|
+
json.dump(up_data, f, ensure_ascii=False, indent=4)
|
204
228
|
return server_list
|
205
229
|
|
206
230
|
async def get_anne_steamid(self, name: str):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "nonebot-plugin-l4d2-server"
|
3
|
-
version = "1.0.
|
3
|
+
version = "1.0.2"
|
4
4
|
description = "L4D2 server related operations plugin for NoneBot2"
|
5
5
|
authors = [
|
6
6
|
{ name = "Agnes_Digital", email = "Z735803792@163.com" },
|
@@ -25,12 +25,15 @@ dependencies = [
|
|
25
25
|
"srctools>=2.3.9",
|
26
26
|
"httpx>=0.22.0,<0.24.1",
|
27
27
|
"msgspec>=0.18.0",
|
28
|
-
"python-a2s>=1.
|
28
|
+
"python-a2s>=1.4.1",
|
29
29
|
"ujson>=5.10.0",
|
30
30
|
"lxml>=5.2.2",
|
31
31
|
"rcon>=2.1.0",
|
32
32
|
"pillow>9",
|
33
33
|
"beautifulsoup4>=4.12.3",
|
34
|
+
"rarfile>=4.2",
|
35
|
+
"pyunpack>=0.3",
|
36
|
+
"aiofiles>=24.1.0",
|
34
37
|
]
|
35
38
|
classifiers = [
|
36
39
|
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
@@ -52,7 +55,7 @@ homepage = "https://github.com/Agnes4m/nonebot_plugin_l4d2_server"
|
|
52
55
|
[tool.pdm.build]
|
53
56
|
includes = []
|
54
57
|
|
55
|
-
[tool.ruff]
|
58
|
+
[tool.ruff.lint]
|
56
59
|
ignore = [
|
57
60
|
"B008",
|
58
61
|
"B905",
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|