nonebot-plugin-l4d2-server 1.1.5__tar.gz → 1.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/PKG-INFO +26 -25
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/README.md +24 -24
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/__main__.py +386 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/commands/__init__.py +1 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/commands/server_groups.py +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/config.py +40 -17
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/data/L4D2/l4d2/l4d2.json +1 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/data/L4D2/l4d2.json +1 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_ban/__init__.py +166 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_ban/utils.py +11 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_help/Help.json +52 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_help/__init__.py +3 -3
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_help/draw.py +4 -1
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//344/273/213/347/273/215.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//344/273/273/345/212/241.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//344/277/241/346/201/257.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//345/205/254/345/221/212.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//345/210/200/345/211/221.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//345/210/207/346/215/242.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//345/210/240/351/231/244.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//345/210/267/346/226/260.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//345/215/241/347/273/204.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//345/223/252/351/207/214.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//345/234/260/345/233/276.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//345/257/274/345/205/245.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//345/257/274/345/207/272.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//345/275/261.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//346/213/274/345/233/276.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//346/216/242/347/264/242.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//346/216/250/351/200/201.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//346/224/266/351/233/206.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//346/224/273/347/225/245.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//346/233/264/346/226/260.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//346/235/220/346/226/231.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//346/237/245/350/257/242.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//346/240/241/351/252/214.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//346/257/217/346/234/210.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//346/267/261/346/270/212.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//346/267/273/345/212/240.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//346/270/205/351/231/244.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//347/212/266/346/200/201.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//347/255/276/345/210/260.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//347/273/221/345/256/232.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//350/241/250.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//350/241/250/346/203/205.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//350/247/222/350/211/262.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//350/256/260/345/275/225.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//351/205/215/347/275/256.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_help/icon//351/207/215/345/220/257.png +0 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_image/__init__.py +16 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/image_tools.py +0 -112
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/img/template/normal.html +6 -4
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/img/template/normal_old.html +0 -2
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/img/template/style.css +7 -2
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_local/__init__.py +1 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_request/__init__.py +216 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_request/draw_msg.py +275 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_request/tj.py +73 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_request/typing.py +36 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/l4_request/utils.py +348 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/message.py +26 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/utils/api/request.py +84 -14
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/utils/api/utils.py +3 -1
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/utils/group_store.py +93 -0
- nonebot_plugin_l4d2_server-1.2.0/nonebot_plugin_l4d2_server/utils/sb_sources.py +57 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/utils/utils.py +2 -50
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/pyproject.toml +6 -1
- nonebot_plugin_l4d2_server-1.2.0/tests/__init__.py +0 -0
- nonebot_plugin_l4d2_server-1.2.0/tests/conftest.py +27 -0
- nonebot_plugin_l4d2_server-1.2.0/tests/help.py +52 -0
- nonebot_plugin_l4d2_server-1.2.0/tests/todo.md +29 -0
- nonebot_plugin_l4d2_server-1.1.5/nonebot_plugin_l4d2_server/__main__.py +0 -289
- nonebot_plugin_l4d2_server-1.1.5/nonebot_plugin_l4d2_server/l4_image/__init__.py +0 -35
- nonebot_plugin_l4d2_server-1.1.5/nonebot_plugin_l4d2_server/l4_image/download.py +0 -96
- nonebot_plugin_l4d2_server-1.1.5/nonebot_plugin_l4d2_server/l4_image/img/anne/back1.jpg +0 -0
- nonebot_plugin_l4d2_server-1.1.5/nonebot_plugin_l4d2_server/l4_image/img/template/bilibili.svg +0 -1
- nonebot_plugin_l4d2_server-1.1.5/nonebot_plugin_l4d2_server/l4_image/vtfs.py +0 -47
- nonebot_plugin_l4d2_server-1.1.5/nonebot_plugin_l4d2_server/l4_request/__init__.py +0 -262
- nonebot_plugin_l4d2_server-1.1.5/nonebot_plugin_l4d2_server/l4_request/draw_msg.py +0 -284
- nonebot_plugin_l4d2_server-1.1.5/nonebot_plugin_l4d2_server/l4_request/utils.py +0 -175
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/LICENSE +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/__init__.py +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/data/font/loli.ttf +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_help/texture2d/badge.png +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_help/texture2d/banner.png +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_help/texture2d/bg.jpg +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_help/texture2d/button.png +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_help/texture2d/icon.png +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/convert.py +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/html_img.py +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/img/anne/anne.html +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/img/anne/back.png +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/img/anne/group_ip.html +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/img/anne/ip.html +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/img/back_img/background.jpg +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/img/head/head.png +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/img/header/logo.png +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/img/header/player1.jpg +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/img/template/github.svg +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/img/template/l.svg +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/img/template/m.svg +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/img/template/vac.png +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/img/template/vac_white.png +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/img/template/vue.css +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/img/template/w.svg +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/img/template/workshop.html +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_image/model.py +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_local/download.py +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_local/file.py +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/l4_local/utils.py +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/utils/api/api.py +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/nonebot_plugin_l4d2_server/utils/api/models.py +0 -0
- {nonebot_plugin_l4d2_server-1.1.5 → nonebot_plugin_l4d2_server-1.2.0}/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.
|
|
3
|
+
Version: 1.2.0
|
|
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>
|
|
@@ -34,6 +34,7 @@ Requires-Dist: rarfile>=4.2
|
|
|
34
34
|
Requires-Dist: pyunpack>=0.3
|
|
35
35
|
Requires-Dist: aiofiles>=24.1.0
|
|
36
36
|
Requires-Dist: bs4==0.0.2
|
|
37
|
+
Requires-Dist: lxml>=6.0.2
|
|
37
38
|
Description-Content-Type: text/markdown
|
|
38
39
|
|
|
39
40
|
<!-- markdownlint-disable MD026 MD031 MD033 MD036 MD041 MD046 MD051 -->
|
|
@@ -45,9 +46,10 @@ Description-Content-Type: text/markdown
|
|
|
45
46
|
|
|
46
47
|
<div align="center">
|
|
47
48
|
|
|
48
|
-
# nonebot_plugin_l4d2_server 1.
|
|
49
|
+
# nonebot_plugin_l4d2_server 1.1.6
|
|
50
|
+
|
|
51
|
+
_✨Nonebot & Left 4 Dead 2 server 操作 ✨_
|
|
49
52
|
|
|
50
|
-
_✨Nonebot & Left 4 Dead 2 server操作✨_
|
|
51
53
|
<div align = "center">
|
|
52
54
|
<a href="https://agnes4m.github.io/l4d2/" target="_blank">文档</a> ·
|
|
53
55
|
<a href="https://agnes4m.github.io/l4d2/reader/#%E5%8A%9F%E8%83%BD-%E6%8C%87%E4%BB%A4-%F0%9F%A4%94" target="_blank">指令列表</a> ·
|
|
@@ -55,8 +57,8 @@ _✨Nonebot & Left 4 Dead 2 server操作✨_
|
|
|
55
57
|
</div><br>
|
|
56
58
|
|
|
57
59
|
<img src="https://img.shields.io/badge/python-3.9+-blue?logo=python&logoColor=edb641" alt="python">
|
|
58
|
-
<a href ="LICENSE">
|
|
59
|
-
<img src="https://img.shields.io/github/license/Agnes4m/nonebot_plugin_l4d2_server">
|
|
60
|
+
<a href ="LICENSE">
|
|
61
|
+
<img src="https://img.shields.io/github/license/Agnes4m/nonebot_plugin_l4d2_server" alt="l4logo">
|
|
60
62
|
</a>
|
|
61
63
|
<img src="https://img.shields.io/badge/nonebot-2.1.0+-red.svg" alt="NoneBot">
|
|
62
64
|
<a href="https://pypi.python.org/pypi/nonebot_plugin_l4d2_server">
|
|
@@ -70,7 +72,7 @@ _✨Nonebot & Left 4 Dead 2 server操作✨_
|
|
|
70
72
|
<img src="https://img.shields.io/badge/code%20style-black-000000.svg?logo=python&logoColor=edb641" alt="black">
|
|
71
73
|
</a>
|
|
72
74
|
|
|
73
|
-
<img src="https://img.shields.io/badge/alconna-0.58.3+-red.svg" alt="NoneBot">
|
|
75
|
+
<img src="https://img.shields.io/badge/alconna-0.58.3+-red.svg" alt="NoneBot">
|
|
74
76
|
|
|
75
77
|
<a href="https://github.com/Agnes4m/nonebot_plugin_l4d2_server/issues">
|
|
76
78
|
<img alt="GitHub issues" src="https://img.shields.io/github/issues/Agnes4m/nonebot_plugin_l4d2_server" alt="issues">
|
|
@@ -85,13 +87,13 @@ _✨Nonebot & Left 4 Dead 2 server操作✨_
|
|
|
85
87
|
</a>
|
|
86
88
|
</div>
|
|
87
89
|
|
|
88
|
-
|
|
89
90
|
## 指令
|
|
90
91
|
|
|
91
|
-
- 在json文件设置的前缀指令,例如设置"云",则指令 云 输出组服务器,云1 输出1号服务器
|
|
92
|
-
-
|
|
93
|
-
- l4
|
|
94
|
-
- l4
|
|
92
|
+
- 在 json 文件设置的前缀指令,例如设置"云",则指令 云 输出组服务器,云 1 输出 1 号服务器
|
|
93
|
+
- `l4d2帮助` 帮助指令
|
|
94
|
+
- l4 图片开启/关闭 超管指令 可以修改输出单图是否为图片输出
|
|
95
|
+
- l4 查找用户 在已知服务器中查找
|
|
96
|
+
- l4 工坊下载 提供创意工坊 id 下载到服务器和群聊
|
|
95
97
|
|
|
96
98
|
## 安装
|
|
97
99
|
|
|
@@ -148,16 +150,15 @@ conda install nonebot-plugin-l4d2-server
|
|
|
148
150
|
## 主要功能
|
|
149
151
|
|
|
150
152
|
- [x] 求生服务器-本地多路径操作(传地图等)
|
|
151
|
-
- [x] 批量查询指定ip服务器状态和玩家
|
|
152
|
-
- [x] connect指令直接呼出服务器信息
|
|
153
|
+
- [x] 批量查询指定 ip 服务器状态和玩家
|
|
154
|
+
- [x] connect 指令直接呼出服务器信息
|
|
153
155
|
- [x] 根据用户名,在已知服务器搜索玩家信息
|
|
154
156
|
|
|
155
|
-
|
|
156
157
|
## [数据结构](./docs/standand.md)
|
|
157
158
|
|
|
158
159
|
暂未更新
|
|
159
160
|
|
|
160
|
-
## env设置
|
|
161
|
+
## env 设置
|
|
161
162
|
|
|
162
163
|
```bash
|
|
163
164
|
l4_enable = True
|
|
@@ -175,18 +176,18 @@ conda install nonebot-plugin-l4d2-server
|
|
|
175
176
|
- 简洁
|
|
176
177
|
```
|
|
177
178
|
|
|
178
|
-
## 和0.x.x更改部分
|
|
179
|
+
## 和 0.x.x 更改部分
|
|
179
180
|
|
|
180
181
|
- 取消了网页控制台(没有卵用)
|
|
181
182
|
- 取消了自动重启(与其他插件功能重复)
|
|
182
|
-
- 取消了git拉取更新(nb规范用pypi)
|
|
183
|
+
- 取消了 git 拉取更新(nb 规范用 pypi)
|
|
183
184
|
- 删除无用部分(依赖太多难以维护)
|
|
184
|
-
- 删除了anne部分,已移植到[这里](https://github.com/Agnes4m/L4D2UID),通过core插件调用
|
|
185
|
+
- 删除了 anne 部分,已移植到[这里](https://github.com/Agnes4m/L4D2UID),通过 core 插件调用
|
|
185
186
|
|
|
186
187
|
## 其他
|
|
187
188
|
|
|
188
|
-
- 本人技术很差,如果您有发现BUG或者更好的建议,欢迎提Issue & Pr
|
|
189
|
-
- 如果本插件对你有帮助,不要忘了点个Star~
|
|
189
|
+
- 本人技术很差,如果您有发现 BUG 或者更好的建议,欢迎提 Issue & Pr
|
|
190
|
+
- 如果本插件对你有帮助,不要忘了点个 Star~
|
|
190
191
|
- 本项目仅供学习使用,请勿用于商业用途
|
|
191
192
|
- [更新日志](./docs/update.md)
|
|
192
193
|
- [GPL-3.0 License](https://github.com/Agnes4m/nonebot_plugin_l4d2_server/blob/main/LICENSE) ©[@Agnes4m](https://github.com/Agnes4m)
|
|
@@ -194,11 +195,11 @@ conda install nonebot-plugin-l4d2-server
|
|
|
194
195
|
## 🌐 感谢
|
|
195
196
|
|
|
196
197
|
- [nonebot2](https://github.com/nonebot/nonebot2)- 聊天机器人的基础框架
|
|
197
|
-
- [饼干](https://github.com/lgc2333) - 指导nonebot2框架的函数使用
|
|
198
|
-
- [wuyi](https://github.com/KimigaiiWuyi/) - 指导pil作图
|
|
198
|
+
- [饼干](https://github.com/lgc2333) - 指导 nonebot2 框架的函数使用
|
|
199
|
+
- [wuyi](https://github.com/KimigaiiWuyi/) - 指导 pil 作图
|
|
199
200
|
|
|
200
201
|
- 感谢以下服主大力支持
|
|
201
202
|
- Michaela's | 机器人功能测试反馈
|
|
202
|
-
- 东 | 提供docker部署方法等建议 | [电信服anne游戏群](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=6i7r5aJ7Jyg0ejby4rt9GWmFRF53nV1K&authKey=ekMsWepBZPL26%2BfJAG%2F95JD0fhvH39%2BIGVyKOvNlXVDbpIclJlly4kXqukL7JhWR&noverify=0&group_code=883237206)
|
|
203
|
-
- 迷茫 | 催命更新byd
|
|
204
|
-
- ArcPav | 积极反馈bug,提供改进思路
|
|
203
|
+
- 东 | 提供 docker 部署方法等建议 | [电信服 anne 游戏群](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=6i7r5aJ7Jyg0ejby4rt9GWmFRF53nV1K&authKey=ekMsWepBZPL26%2BfJAG%2F95JD0fhvH39%2BIGVyKOvNlXVDbpIclJlly4kXqukL7JhWR&noverify=0&group_code=883237206)
|
|
204
|
+
- 迷茫 | 催命更新 byd
|
|
205
|
+
- ArcPav | 积极反馈 bug,提供改进思路
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
<div align="center">
|
|
9
9
|
|
|
10
|
-
# nonebot_plugin_l4d2_server 1.
|
|
10
|
+
# nonebot_plugin_l4d2_server 1.1.6
|
|
11
|
+
|
|
12
|
+
_✨Nonebot & Left 4 Dead 2 server 操作 ✨_
|
|
11
13
|
|
|
12
|
-
_✨Nonebot & Left 4 Dead 2 server操作✨_
|
|
13
14
|
<div align = "center">
|
|
14
15
|
<a href="https://agnes4m.github.io/l4d2/" target="_blank">文档</a> ·
|
|
15
16
|
<a href="https://agnes4m.github.io/l4d2/reader/#%E5%8A%9F%E8%83%BD-%E6%8C%87%E4%BB%A4-%F0%9F%A4%94" target="_blank">指令列表</a> ·
|
|
@@ -17,8 +18,8 @@ _✨Nonebot & Left 4 Dead 2 server操作✨_
|
|
|
17
18
|
</div><br>
|
|
18
19
|
|
|
19
20
|
<img src="https://img.shields.io/badge/python-3.9+-blue?logo=python&logoColor=edb641" alt="python">
|
|
20
|
-
<a href ="LICENSE">
|
|
21
|
-
<img src="https://img.shields.io/github/license/Agnes4m/nonebot_plugin_l4d2_server">
|
|
21
|
+
<a href ="LICENSE">
|
|
22
|
+
<img src="https://img.shields.io/github/license/Agnes4m/nonebot_plugin_l4d2_server" alt="l4logo">
|
|
22
23
|
</a>
|
|
23
24
|
<img src="https://img.shields.io/badge/nonebot-2.1.0+-red.svg" alt="NoneBot">
|
|
24
25
|
<a href="https://pypi.python.org/pypi/nonebot_plugin_l4d2_server">
|
|
@@ -32,7 +33,7 @@ _✨Nonebot & Left 4 Dead 2 server操作✨_
|
|
|
32
33
|
<img src="https://img.shields.io/badge/code%20style-black-000000.svg?logo=python&logoColor=edb641" alt="black">
|
|
33
34
|
</a>
|
|
34
35
|
|
|
35
|
-
<img src="https://img.shields.io/badge/alconna-0.58.3+-red.svg" alt="NoneBot">
|
|
36
|
+
<img src="https://img.shields.io/badge/alconna-0.58.3+-red.svg" alt="NoneBot">
|
|
36
37
|
|
|
37
38
|
<a href="https://github.com/Agnes4m/nonebot_plugin_l4d2_server/issues">
|
|
38
39
|
<img alt="GitHub issues" src="https://img.shields.io/github/issues/Agnes4m/nonebot_plugin_l4d2_server" alt="issues">
|
|
@@ -47,13 +48,13 @@ _✨Nonebot & Left 4 Dead 2 server操作✨_
|
|
|
47
48
|
</a>
|
|
48
49
|
</div>
|
|
49
50
|
|
|
50
|
-
|
|
51
51
|
## 指令
|
|
52
52
|
|
|
53
|
-
- 在json文件设置的前缀指令,例如设置"云",则指令 云 输出组服务器,云1 输出1号服务器
|
|
54
|
-
-
|
|
55
|
-
- l4
|
|
56
|
-
- l4
|
|
53
|
+
- 在 json 文件设置的前缀指令,例如设置"云",则指令 云 输出组服务器,云 1 输出 1 号服务器
|
|
54
|
+
- `l4d2帮助` 帮助指令
|
|
55
|
+
- l4 图片开启/关闭 超管指令 可以修改输出单图是否为图片输出
|
|
56
|
+
- l4 查找用户 在已知服务器中查找
|
|
57
|
+
- l4 工坊下载 提供创意工坊 id 下载到服务器和群聊
|
|
57
58
|
|
|
58
59
|
## 安装
|
|
59
60
|
|
|
@@ -110,16 +111,15 @@ conda install nonebot-plugin-l4d2-server
|
|
|
110
111
|
## 主要功能
|
|
111
112
|
|
|
112
113
|
- [x] 求生服务器-本地多路径操作(传地图等)
|
|
113
|
-
- [x] 批量查询指定ip服务器状态和玩家
|
|
114
|
-
- [x] connect指令直接呼出服务器信息
|
|
114
|
+
- [x] 批量查询指定 ip 服务器状态和玩家
|
|
115
|
+
- [x] connect 指令直接呼出服务器信息
|
|
115
116
|
- [x] 根据用户名,在已知服务器搜索玩家信息
|
|
116
117
|
|
|
117
|
-
|
|
118
118
|
## [数据结构](./docs/standand.md)
|
|
119
119
|
|
|
120
120
|
暂未更新
|
|
121
121
|
|
|
122
|
-
## env设置
|
|
122
|
+
## env 设置
|
|
123
123
|
|
|
124
124
|
```bash
|
|
125
125
|
l4_enable = True
|
|
@@ -137,18 +137,18 @@ conda install nonebot-plugin-l4d2-server
|
|
|
137
137
|
- 简洁
|
|
138
138
|
```
|
|
139
139
|
|
|
140
|
-
## 和0.x.x更改部分
|
|
140
|
+
## 和 0.x.x 更改部分
|
|
141
141
|
|
|
142
142
|
- 取消了网页控制台(没有卵用)
|
|
143
143
|
- 取消了自动重启(与其他插件功能重复)
|
|
144
|
-
- 取消了git拉取更新(nb规范用pypi)
|
|
144
|
+
- 取消了 git 拉取更新(nb 规范用 pypi)
|
|
145
145
|
- 删除无用部分(依赖太多难以维护)
|
|
146
|
-
- 删除了anne部分,已移植到[这里](https://github.com/Agnes4m/L4D2UID),通过core插件调用
|
|
146
|
+
- 删除了 anne 部分,已移植到[这里](https://github.com/Agnes4m/L4D2UID),通过 core 插件调用
|
|
147
147
|
|
|
148
148
|
## 其他
|
|
149
149
|
|
|
150
|
-
- 本人技术很差,如果您有发现BUG或者更好的建议,欢迎提Issue & Pr
|
|
151
|
-
- 如果本插件对你有帮助,不要忘了点个Star~
|
|
150
|
+
- 本人技术很差,如果您有发现 BUG 或者更好的建议,欢迎提 Issue & Pr
|
|
151
|
+
- 如果本插件对你有帮助,不要忘了点个 Star~
|
|
152
152
|
- 本项目仅供学习使用,请勿用于商业用途
|
|
153
153
|
- [更新日志](./docs/update.md)
|
|
154
154
|
- [GPL-3.0 License](https://github.com/Agnes4m/nonebot_plugin_l4d2_server/blob/main/LICENSE) ©[@Agnes4m](https://github.com/Agnes4m)
|
|
@@ -156,11 +156,11 @@ conda install nonebot-plugin-l4d2-server
|
|
|
156
156
|
## 🌐 感谢
|
|
157
157
|
|
|
158
158
|
- [nonebot2](https://github.com/nonebot/nonebot2)- 聊天机器人的基础框架
|
|
159
|
-
- [饼干](https://github.com/lgc2333) - 指导nonebot2框架的函数使用
|
|
160
|
-
- [wuyi](https://github.com/KimigaiiWuyi/) - 指导pil作图
|
|
159
|
+
- [饼干](https://github.com/lgc2333) - 指导 nonebot2 框架的函数使用
|
|
160
|
+
- [wuyi](https://github.com/KimigaiiWuyi/) - 指导 pil 作图
|
|
161
161
|
|
|
162
162
|
- 感谢以下服主大力支持
|
|
163
163
|
- Michaela's | 机器人功能测试反馈
|
|
164
|
-
- 东 | 提供docker部署方法等建议 | [电信服anne游戏群](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=6i7r5aJ7Jyg0ejby4rt9GWmFRF53nV1K&authKey=ekMsWepBZPL26%2BfJAG%2F95JD0fhvH39%2BIGVyKOvNlXVDbpIclJlly4kXqukL7JhWR&noverify=0&group_code=883237206)
|
|
165
|
-
- 迷茫 | 催命更新byd
|
|
166
|
-
- ArcPav | 积极反馈bug,提供改进思路
|
|
164
|
+
- 东 | 提供 docker 部署方法等建议 | [电信服 anne 游戏群](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=6i7r5aJ7Jyg0ejby4rt9GWmFRF53nV1K&authKey=ekMsWepBZPL26%2BfJAG%2F95JD0fhvH39%2BIGVyKOvNlXVDbpIclJlly4kXqukL7JhWR&noverify=0&group_code=883237206)
|
|
165
|
+
- 迷茫 | 催命更新 byd
|
|
166
|
+
- ArcPav | 积极反馈 bug,提供改进思路
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
"""
|
|
2
|
+
* Copyright (c) 2023, Agnes Digital
|
|
3
|
+
*
|
|
4
|
+
* This program is free software: you can redistribute it and/or modify
|
|
5
|
+
* it under the terms of the GNU General Public License as published by
|
|
6
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
7
|
+
* (at your option) any later version.
|
|
8
|
+
*
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License
|
|
15
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
from typing import List, Optional, cast
|
|
20
|
+
|
|
21
|
+
import ujson as json
|
|
22
|
+
from nonebot import get_driver
|
|
23
|
+
from nonebot.adapters import Message
|
|
24
|
+
from nonebot.log import logger
|
|
25
|
+
from nonebot.matcher import Matcher
|
|
26
|
+
from nonebot.params import CommandArg, CommandStart, RawCommand
|
|
27
|
+
from nonebot.permission import SUPERUSER
|
|
28
|
+
from nonebot.plugin import on_command
|
|
29
|
+
from nonebot_plugin_alconna import UniMessage
|
|
30
|
+
|
|
31
|
+
from .config import config, config_manager
|
|
32
|
+
from .l4_ban import l4_request
|
|
33
|
+
from .l4_ban.utils import refresh_server_command_rule
|
|
34
|
+
from .l4_help import get_l4d2_core_help
|
|
35
|
+
from .l4_local import * # noqa: F403
|
|
36
|
+
from .l4_request import (
|
|
37
|
+
COMMAND,
|
|
38
|
+
get_all_server_detail,
|
|
39
|
+
get_ip_server,
|
|
40
|
+
get_server_detail,
|
|
41
|
+
reload_ip,
|
|
42
|
+
server_find,
|
|
43
|
+
tj_request,
|
|
44
|
+
)
|
|
45
|
+
from .message import Gm, Sm
|
|
46
|
+
from .utils.api.models import OutServer
|
|
47
|
+
from .utils.api.request import L4API, L4D2Api
|
|
48
|
+
from .utils.api.utils import out_msg_out
|
|
49
|
+
from .utils.group_store import set_group
|
|
50
|
+
from .utils.sb_sources import load_pages
|
|
51
|
+
from .utils.utils import split_maohao
|
|
52
|
+
|
|
53
|
+
driver = get_driver()
|
|
54
|
+
|
|
55
|
+
reload_ip()
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
l4_help = on_command("l4help", aliases={"l4d2帮助"})
|
|
59
|
+
|
|
60
|
+
l4_reload = on_command("l4reload", aliases={"l4刷新,l4重载"})
|
|
61
|
+
l4_all = on_command("l4all", aliases={"l4全服"})
|
|
62
|
+
l4_connect = on_command("connect", aliases={"l4连接"})
|
|
63
|
+
l4_find_player = on_command("l4find", aliases={"l4查找"})
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
config_path = Path(config.l4_path) / "config.json"
|
|
67
|
+
refresh_server_command_rule(l4_request)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
async def sync_sb_pages_groups() -> None:
|
|
71
|
+
"""根据 sb_pages.json 内容刷新所有服务器组"""
|
|
72
|
+
pages = await load_pages()
|
|
73
|
+
if not pages:
|
|
74
|
+
logger.info("sb_pages.json 为空,跳过启动时刷新")
|
|
75
|
+
reload_ip()
|
|
76
|
+
refresh_server_command_rule(l4_request)
|
|
77
|
+
return
|
|
78
|
+
|
|
79
|
+
api = L4D2Api()
|
|
80
|
+
ok = 0
|
|
81
|
+
failed: List[str] = []
|
|
82
|
+
for tag, page in pages.items():
|
|
83
|
+
try:
|
|
84
|
+
servers = await api.get_sourceban(tag, page)
|
|
85
|
+
await set_group(tag, servers)
|
|
86
|
+
ok += 1
|
|
87
|
+
except Exception as exc:
|
|
88
|
+
failed.append(f"{tag}: {exc}")
|
|
89
|
+
|
|
90
|
+
reload_ip()
|
|
91
|
+
refresh_server_command_rule(l4_request)
|
|
92
|
+
|
|
93
|
+
if ok:
|
|
94
|
+
logger.success(f"启动时已刷新 {ok} 个服务器组")
|
|
95
|
+
if failed:
|
|
96
|
+
logger.warning("以下服务器组刷新失败:" + "; ".join(failed))
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
@driver.on_startup
|
|
100
|
+
async def _sync_groups_on_startup() -> None:
|
|
101
|
+
await sync_sb_pages_groups()
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@l4_help.handle()
|
|
105
|
+
async def _():
|
|
106
|
+
"""帮助"""
|
|
107
|
+
logger.info("开始执行[l4d2帮助]")
|
|
108
|
+
im = await get_l4d2_core_help()
|
|
109
|
+
await out_msg_out(im)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
@l4_request.handle()
|
|
113
|
+
async def _(
|
|
114
|
+
start: str = CommandStart(),
|
|
115
|
+
command: str = RawCommand(),
|
|
116
|
+
args: Message = CommandArg(),
|
|
117
|
+
):
|
|
118
|
+
"""
|
|
119
|
+
异步函数,用于处理特定的指令。
|
|
120
|
+
|
|
121
|
+
Args:
|
|
122
|
+
start (str, optional): 指令的开头部分,默认为 CommandStart() 返回的值。
|
|
123
|
+
command (str, optional): 完整的指令字符串,默认为 RawCommand() 返回的值。
|
|
124
|
+
args (Message, optional): 指令后的参数,默认为 CommandArg() 返回的值。
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
None
|
|
128
|
+
|
|
129
|
+
Examples:
|
|
130
|
+
示例指令:"/橘5"
|
|
131
|
+
- start: "/" (指令的开头部分)
|
|
132
|
+
- command: "/橘" (完整的指令字符串)
|
|
133
|
+
- args: "5" (指令后的参数)
|
|
134
|
+
|
|
135
|
+
Notes:
|
|
136
|
+
1. 如果 start 存在,会将 command 中的 start 部分替换为空字符串。
|
|
137
|
+
2. 如果 command 等于 "anne",则将其替换为 "云"。
|
|
138
|
+
3. 提取 args 中的纯文本内容,如果内容非空且不是数字,则返回。
|
|
139
|
+
4. 如果 args 为空,则将其设置为 None。
|
|
140
|
+
5. 使用 logger 记录处理过程中的信息。
|
|
141
|
+
6. 调用 get_server_detail 函数获取服务器详情,并根据返回结果发送相应的消息。
|
|
142
|
+
7. 如果 get_server_detail 返回 None,则发送 "服务器无响应" 的文本消息。
|
|
143
|
+
"""
|
|
144
|
+
logger.info(f"[l4]开始执行请求]:{command}")
|
|
145
|
+
if start:
|
|
146
|
+
command = command.replace(start, "")
|
|
147
|
+
if command == "anne":
|
|
148
|
+
command = "云"
|
|
149
|
+
|
|
150
|
+
_id: Optional[str] = args.extract_plain_text().strip()
|
|
151
|
+
if _id and not _id.isdigit():
|
|
152
|
+
logger.info(Gm.no_id)
|
|
153
|
+
return
|
|
154
|
+
|
|
155
|
+
if not _id:
|
|
156
|
+
_id = None
|
|
157
|
+
else:
|
|
158
|
+
logger.info(f"ID: {_id}")
|
|
159
|
+
|
|
160
|
+
msg = await get_server_detail(command, _id)
|
|
161
|
+
if msg is None:
|
|
162
|
+
await out_msg_out(Sm.server_outtime)
|
|
163
|
+
return
|
|
164
|
+
|
|
165
|
+
logger_info_msg = Gm.outputing_group
|
|
166
|
+
if _id is not None:
|
|
167
|
+
logger_info_msg += f" {_id}"
|
|
168
|
+
logger.info(logger_info_msg, is_connect=config.l4_image)
|
|
169
|
+
await out_msg_out(msg)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
@l4_find_player.handle()
|
|
173
|
+
async def _(
|
|
174
|
+
args: Message = CommandArg(),
|
|
175
|
+
):
|
|
176
|
+
# 以后有时间补img格式
|
|
177
|
+
msg: str = args.extract_plain_text().strip()
|
|
178
|
+
if not msg:
|
|
179
|
+
return UniMessage.text(Gm.add_name)
|
|
180
|
+
tag_list: List[str] = msg.split(" ", maxsplit=1)
|
|
181
|
+
if len(tag_list) == 1:
|
|
182
|
+
await UniMessage.text(Sm.no_group_search).send()
|
|
183
|
+
name = tag_list[0]
|
|
184
|
+
out: List[OutServer] = await server_find(is_img=False) # type: ignore
|
|
185
|
+
logger.info(out)
|
|
186
|
+
logger.info(type(out))
|
|
187
|
+
out_msg = Sm.no_player
|
|
188
|
+
for one in out:
|
|
189
|
+
logger.info(one)
|
|
190
|
+
for player in one["player"]:
|
|
191
|
+
if name in player.name:
|
|
192
|
+
out_msg = await get_ip_server(f"{one['host']}:{one['port']}")
|
|
193
|
+
logger.info(config.l4_connect)
|
|
194
|
+
logger.info(type(out_msg))
|
|
195
|
+
if config.l4_connect and isinstance(out_msg, bytes):
|
|
196
|
+
logger.info(f"connect {one['host']}:{one['port']}")
|
|
197
|
+
out_msgs = UniMessage.image(raw=out_msg) + UniMessage.text(
|
|
198
|
+
f"\nconnect {one['host']}:{one['port']}",
|
|
199
|
+
)
|
|
200
|
+
elif config.l4_connect and isinstance(out_msg, str):
|
|
201
|
+
logger.info(f"connect {one['host']}:{one['port']}")
|
|
202
|
+
out_msgs = UniMessage.text(out_msg) + UniMessage.text(
|
|
203
|
+
f"\nconnect {one['host']}:{one['port']}",
|
|
204
|
+
)
|
|
205
|
+
elif isinstance(out_msg, str):
|
|
206
|
+
out_msgs = UniMessage.text(out_msg)
|
|
207
|
+
else:
|
|
208
|
+
out_msgs = UniMessage.image(raw=out_msg)
|
|
209
|
+
return await out_msg_out(out_msgs)
|
|
210
|
+
return None
|
|
211
|
+
if len(tag_list) == 2:
|
|
212
|
+
group, name = tag_list
|
|
213
|
+
await UniMessage.text(f"正在查询{group}组").send()
|
|
214
|
+
out = cast(List[OutServer], await server_find(command=group, is_img=True))
|
|
215
|
+
out_msg = Gm.no_player
|
|
216
|
+
for one in out:
|
|
217
|
+
for player in one["player"]:
|
|
218
|
+
if name in player.name:
|
|
219
|
+
out_msg = await get_ip_server(f"{one['host']}:{one['port']}")
|
|
220
|
+
logger.info(config.l4_connect)
|
|
221
|
+
logger.info(type(out_msg))
|
|
222
|
+
if config.l4_connect and isinstance(out_msg, bytes):
|
|
223
|
+
logger.info(f"connect {one['host']}:{one['port']}")
|
|
224
|
+
out_msgs = UniMessage.image(raw=out_msg) + UniMessage.text(
|
|
225
|
+
f"\nconnect {one['host']}:{one['port']}",
|
|
226
|
+
)
|
|
227
|
+
elif config.l4_connect and isinstance(out_msg, str):
|
|
228
|
+
logger.info(f"connect {one['host']}:{one['port']}")
|
|
229
|
+
out_msgs = UniMessage.text(out_msg) + UniMessage.text(
|
|
230
|
+
f"\nconnect {one['host']}:{one['port']}",
|
|
231
|
+
)
|
|
232
|
+
elif isinstance(out_msg, str):
|
|
233
|
+
out_msgs = UniMessage.text(out_msg)
|
|
234
|
+
else:
|
|
235
|
+
out_msgs = UniMessage.image(raw=out_msg)
|
|
236
|
+
|
|
237
|
+
return await out_msg_out(out_msgs)
|
|
238
|
+
return None
|
|
239
|
+
return None
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
@l4_all.handle()
|
|
243
|
+
async def _():
|
|
244
|
+
await out_msg_out(await get_all_server_detail())
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
@l4_connect.handle()
|
|
248
|
+
async def _(args: Message = CommandArg()):
|
|
249
|
+
ip: Optional[str] = args.extract_plain_text()
|
|
250
|
+
if ip is not None:
|
|
251
|
+
host, port = split_maohao(ip)
|
|
252
|
+
await out_msg_out(
|
|
253
|
+
await get_ip_server(ip),
|
|
254
|
+
is_connect=config.l4_connect,
|
|
255
|
+
host=host,
|
|
256
|
+
port=str(port),
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
@l4_reload.handle()
|
|
261
|
+
async def _(args: Message = CommandArg()):
|
|
262
|
+
arg = args.extract_plain_text().strip()
|
|
263
|
+
if not arg:
|
|
264
|
+
with (Path(config.l4_path) / "l4d2.json").open("r", encoding="utf-8") as f:
|
|
265
|
+
content = f.read().strip()
|
|
266
|
+
ip_json = json.loads(content)
|
|
267
|
+
for tag, url in ip_json.items():
|
|
268
|
+
logger.info(f"重载{tag}的ip")
|
|
269
|
+
await L4API.get_sourceban(tag, url)
|
|
270
|
+
reload_ip()
|
|
271
|
+
refresh_server_command_rule(l4_request)
|
|
272
|
+
logger.success("重载ip完成")
|
|
273
|
+
await out_msg_out("重载ip完成")
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
# l4_add_ban = on_command("l4addban", aliases={"l4添加ban"})
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
# @l4_add_ban.handle()
|
|
280
|
+
# async def _(args: Message = CommandArg()):
|
|
281
|
+
# arg = args.extract_plain_text().strip().split(" ")
|
|
282
|
+
# if len(arg) != 2:
|
|
283
|
+
# await UniMessage.text("请在命令后增加响应指令名和网址").finish()
|
|
284
|
+
|
|
285
|
+
# config_data = read_config(config_path)
|
|
286
|
+
# config_data.update({arg[0]: arg[1]})
|
|
287
|
+
# write_config(config_path, config_data)
|
|
288
|
+
|
|
289
|
+
# await L4API.get_sourceban(arg[0], arg[1])
|
|
290
|
+
# reload_ip()
|
|
291
|
+
# refresh_server_command_rule(l4_request)
|
|
292
|
+
# await UniMessage.text("添加成功\n组名: {arg[0]}\n网址: {arg[1]}").send()
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
# l4_del_ban = on_command("l4delban", aliases={"l4删除ban", "l4移除ban"})
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
# @l4_del_ban.handle()
|
|
299
|
+
# async def _(args: Message = CommandArg()):
|
|
300
|
+
# arg = args.extract_plain_text().strip().split(" ")
|
|
301
|
+
# if len(arg) not in [1, 2]:
|
|
302
|
+
# await UniMessage.text("请在命令后增加响应指令名或者带响应网址").finish()
|
|
303
|
+
# elif len(arg) == 1:
|
|
304
|
+
# if not Path(Path(config.l4_path) / "config.json").is_file():
|
|
305
|
+
# await UniMessage.text("没有添加过组名").finish()
|
|
306
|
+
# else:
|
|
307
|
+
# with (Path(config.l4_path) / "config.json").open(
|
|
308
|
+
# "r",
|
|
309
|
+
# encoding="utf-8",
|
|
310
|
+
# ) as f:
|
|
311
|
+
# content = f.read().strip()
|
|
312
|
+
# config_data = json.loads(content)
|
|
313
|
+
# if arg[0] not in config_data:
|
|
314
|
+
# await UniMessage.text("没有添加过这个组").finish()
|
|
315
|
+
# else:
|
|
316
|
+
# del config_data[arg[0]]
|
|
317
|
+
# async with aiofiles.open(config_path, "w", encoding="utf-8") as f:
|
|
318
|
+
# json.dump(config_data, f, ensure_ascii=False, indent=4)
|
|
319
|
+
# await out_msg_out(f"删除成功,组名:{arg[0]}")
|
|
320
|
+
# elif len(arg) == 2:
|
|
321
|
+
# if not Path(Path(config.l4_path) / "config.json").is_file():
|
|
322
|
+
# await UniMessage.text("没有添加过组名").finish()
|
|
323
|
+
# else:
|
|
324
|
+
# with (Path(config.l4_path) / "config.json").open(
|
|
325
|
+
# "r",
|
|
326
|
+
# encoding="utf-8",
|
|
327
|
+
# ) as f:
|
|
328
|
+
# content = f.read().strip()
|
|
329
|
+
# config_datas = json.loads(content)
|
|
330
|
+
# if arg[0] not in config_datas:
|
|
331
|
+
# await UniMessage.text("没有添加过这个组").finish()
|
|
332
|
+
# else:
|
|
333
|
+
# config_datas[arg[0]] = arg[1]
|
|
334
|
+
# async with aiofiles.open(config_path, "w", encoding="utf-8") as f:
|
|
335
|
+
# json.dump(config_datas, f, ensure_ascii=False, indent=4)
|
|
336
|
+
# await out_msg_out(f"修改成功,组名:{arg[0]},网址:{arg[1]}")
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
if "云" in COMMAND:
|
|
340
|
+
ld_tj = on_command("tj", aliases={"探监"})
|
|
341
|
+
ld_zl = on_command("zl")
|
|
342
|
+
ld_kl = on_command("kl")
|
|
343
|
+
|
|
344
|
+
@ld_tj.handle()
|
|
345
|
+
async def _(matcher: Matcher):
|
|
346
|
+
await matcher.send("正在寻找牢房信息")
|
|
347
|
+
await matcher.finish(await tj_request("云", "tj"))
|
|
348
|
+
|
|
349
|
+
@ld_zl.handle()
|
|
350
|
+
async def _(matcher: Matcher):
|
|
351
|
+
await matcher.send("正在寻找牢房信息")
|
|
352
|
+
await matcher.finish(await tj_request("云", "zl"))
|
|
353
|
+
|
|
354
|
+
@ld_kl.handle()
|
|
355
|
+
async def _(matcher: Matcher):
|
|
356
|
+
await matcher.send("正在寻找牢房信息")
|
|
357
|
+
await matcher.finish(await tj_request("云", "kl"))
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
## 以下为配置修改
|
|
361
|
+
|
|
362
|
+
img_trung = on_command("l4img", aliases={"l4图片"}, permission=SUPERUSER)
|
|
363
|
+
style_trung = on_command("l4style", aliases={"l4风格切换"}, permission=SUPERUSER)
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
@img_trung.handle()
|
|
367
|
+
async def _(args: Message = CommandArg()):
|
|
368
|
+
arg = args.extract_plain_text().strip().lower()
|
|
369
|
+
if arg == "开启":
|
|
370
|
+
config_manager.update_image_config(enabled=True)
|
|
371
|
+
await out_msg_out("[l4]已开启图片模式")
|
|
372
|
+
elif arg == "关闭":
|
|
373
|
+
config_manager.update_image_config(enabled=False)
|
|
374
|
+
await out_msg_out("[l4]已关闭图片模式")
|
|
375
|
+
else:
|
|
376
|
+
await UniMessage.text("请在参数后加上开启或关闭").finish()
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
@style_trung.handle()
|
|
380
|
+
async def _():
|
|
381
|
+
if config.l4_style == "default":
|
|
382
|
+
config_manager.update_style_config(style="old")
|
|
383
|
+
await UniMessage.text("[l4]已切换为旧风格").finish()
|
|
384
|
+
else:
|
|
385
|
+
config_manager.update_style_config(style="default")
|
|
386
|
+
await UniMessage.text("[l4]已切换为默认风格").finish()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Command utilities for L4D2 server plugin."""
|
|
File without changes
|