nonebot-plugin-l4d2-server 0.5.6.7__py3-none-any.whl → 0.5.7__py3-none-any.whl
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/__init__.py +6 -2
- nonebot_plugin_l4d2_server/l4d2_file/input_json.py +1 -1
- nonebot_plugin_l4d2_server/l4d2_queries/__init__.py +0 -1
- nonebot_plugin_l4d2_server/l4d2_utils/command.py +11 -21
- nonebot_plugin_l4d2_server/l4d2_utils/config.py +2 -1
- nonebot_plugin_l4d2_server/l4d2_utils/utils.py +21 -1
- nonebot_plugin_l4d2_server/l4d2_web/webUI.py +5 -2
- {nonebot_plugin_l4d2_server-0.5.6.7.dist-info → nonebot_plugin_l4d2_server-0.5.7.dist-info}/METADATA +1 -1
- {nonebot_plugin_l4d2_server-0.5.6.7.dist-info → nonebot_plugin_l4d2_server-0.5.7.dist-info}/RECORD +11 -11
- {nonebot_plugin_l4d2_server-0.5.6.7.dist-info → nonebot_plugin_l4d2_server-0.5.7.dist-info}/LICENSE +0 -0
- {nonebot_plugin_l4d2_server-0.5.6.7.dist-info → nonebot_plugin_l4d2_server-0.5.7.dist-info}/WHEEL +0 -0
@@ -14,6 +14,10 @@
|
|
14
14
|
* You should have received a copy of the GNU General Public License
|
15
15
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
16
16
|
"""
|
17
|
+
from nonebot import require
|
18
|
+
require('nonebot_plugin_apscheduler')
|
19
|
+
require('nonebot_plugin_htmlrender')
|
20
|
+
require('nonebot_plugin_txt2img')
|
17
21
|
from .l4d2_web import web,webUI
|
18
22
|
|
19
23
|
from typing import Tuple,Union,List
|
@@ -78,7 +82,7 @@ logo ="""
|
|
78
82
|
"""
|
79
83
|
|
80
84
|
|
81
|
-
__version__ = "0.5.
|
85
|
+
__version__ = "0.5.7"
|
82
86
|
__plugin_meta__ = PluginMetadata(
|
83
87
|
name="求生之路小助手",
|
84
88
|
description='群内对有关求生之路的查询和操作',
|
@@ -292,7 +296,7 @@ async def _(matcher:Matcher,event:MessageEvent,keyword:str = Keyword()):
|
|
292
296
|
await matcher.finish()
|
293
297
|
ip_list = split_maohao(one_msg)
|
294
298
|
msg = await queries_server(ip_list)
|
295
|
-
await
|
299
|
+
await str_to_picstr(msg,matcher)
|
296
300
|
|
297
301
|
|
298
302
|
@add_queries.handle()
|
@@ -4,7 +4,6 @@ from typing import List
|
|
4
4
|
async def queries(ip:str,port:int):
|
5
5
|
port = int(port)
|
6
6
|
msg_dict = await queries_dict(ip,port)
|
7
|
-
message = 'ip:' + msg_dict['ip'] + '\n'
|
8
7
|
message += '名称:' + msg_dict['name'] + '\n'
|
9
8
|
message += f"地图:{msg_dict['map_']}\n"
|
10
9
|
message += f"延迟:{msg_dict['ping']}\n"
|
@@ -139,11 +139,12 @@ async def get_des_ip():
|
|
139
139
|
count_ips(ALL_HOST)
|
140
140
|
ip_anne_list=[]
|
141
141
|
try:
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
142
|
+
for one_tag in l4_config.l4_zl_tag:
|
143
|
+
ips = ALL_HOST[one_tag]
|
144
|
+
ip_anne_list = []
|
145
|
+
for one_ip in ips:
|
146
|
+
host,port = split_maohao(one_ip['ip'])
|
147
|
+
ip_anne_list.append((one_ip['id'],host,port))
|
147
148
|
except KeyError:
|
148
149
|
pass
|
149
150
|
await get_read_ip(ip_anne_list)
|
@@ -152,18 +153,18 @@ async def get_des_ip():
|
|
152
153
|
@tan_jian.handle()
|
153
154
|
async def _(matcher:Matcher,event:MessageEvent):
|
154
155
|
msg = await get_tan_jian(ip_anne_list,1)
|
155
|
-
await
|
156
|
+
await str_to_picstr(push_msg=msg,matcher=matcher)
|
156
157
|
|
157
158
|
@prison.handle()
|
158
159
|
async def _(matcher:Matcher,event:MessageEvent):
|
159
160
|
msg = await get_tan_jian(ip_anne_list,2)
|
160
|
-
await
|
161
|
+
await str_to_picstr(push_msg=msg,matcher=matcher)
|
161
162
|
|
162
163
|
@open_prison.handle()
|
163
164
|
async def _(matcher:Matcher,event:MessageEvent):
|
164
165
|
|
165
166
|
msg = await get_tan_jian(ip_anne_list,3)
|
166
|
-
await
|
167
|
+
await str_to_picstr(push_msg=msg,matcher=matcher)
|
167
168
|
|
168
169
|
|
169
170
|
|
@@ -171,10 +172,6 @@ async def get_read_ip(ip_anne_list):
|
|
171
172
|
get_ip = on_command('anne',aliases=server_key(),priority=80,block=True)
|
172
173
|
@get_ip.handle()
|
173
174
|
async def _(matcher:Matcher,start:str = CommandStart(),command: str = RawCommand(),args:Message = CommandArg()):
|
174
|
-
# global matchers
|
175
|
-
# if get_ip.plugin_name not in matchers:
|
176
|
-
# matchers[get_ip.plugin_name] = []
|
177
|
-
# matchers[get_ip.plugin_name].append(get_ip)
|
178
175
|
if start:
|
179
176
|
command = command.replace(start,'')
|
180
177
|
if command == 'anne':
|
@@ -186,14 +183,7 @@ async def get_read_ip(ip_anne_list):
|
|
186
183
|
elif msg and isinstance(push_msg ,list):
|
187
184
|
await matcher.finish(MessageSegment.image(push_msg[0]) + Message(push_msg[-1]))
|
188
185
|
elif msg and isinstance(push_msg ,str):
|
189
|
-
|
190
|
-
lines = push_msg.splitlines()
|
191
|
-
first_str = lines[0]
|
192
|
-
last_str = lines[-1]
|
193
|
-
push_msg = '\n'.join(lines[1:-1])
|
194
|
-
await matcher.finish(mode_txt_to_img(first_str,push_msg)+Message(last_str))
|
195
|
-
else:
|
196
|
-
await matcher.finish(push_msg)
|
186
|
+
await str_to_picstr(push_msg,matcher)
|
197
187
|
|
198
188
|
async def get_ip_to_mes(msg:str ,command: str = ''):
|
199
189
|
if not msg:
|
@@ -254,6 +244,6 @@ async def init():
|
|
254
244
|
|
255
245
|
|
256
246
|
|
257
|
-
@driver.
|
247
|
+
@driver.on_startup
|
258
248
|
async def _():
|
259
249
|
await init()
|
@@ -54,10 +54,10 @@ class L4d2GroupConfig(BaseModel):
|
|
54
54
|
|
55
55
|
class L4d2Config(BaseModel):
|
56
56
|
total_enable: bool = Field(True, alias='是否全局启用求生功能')
|
57
|
+
l4_image: bool = Field(False , alias='是否启用图片')
|
57
58
|
web_username: str = Field('l4d2', alias='后台管理用户名')
|
58
59
|
web_password: str = Field('admin', alias='后台管理密码')
|
59
60
|
l4_style: str = Field("standard", alias='图片风格')
|
60
|
-
l4_image: bool = Field(False , alias='是否启用图片')
|
61
61
|
l4_ipall: List[Dict[str,Union[str,int,bool]]] = Field(
|
62
62
|
[{
|
63
63
|
'id_rank':'1',
|
@@ -89,6 +89,7 @@ class L4d2Config(BaseModel):
|
|
89
89
|
l4_only:bool = Field(False, alias='下载地图是是否阻碍其他指令')
|
90
90
|
l4_push_interval: int = Field(3, alias='定时任务间隔')
|
91
91
|
l4_push_times: int = Field(10, alias='定时任务次数')
|
92
|
+
l4_connect: bool = Field(True, alias="是否在查服命令后加入connect ip")
|
92
93
|
group_config: Dict[int, L4d2GroupConfig] = Field({}, alias='分群配置')
|
93
94
|
|
94
95
|
def update(self, **kwargs):
|
@@ -1,6 +1,7 @@
|
|
1
1
|
|
2
2
|
from nonebot.adapters.onebot.v11 import Bot,MessageEvent,GroupMessageEvent
|
3
3
|
from nonebot.log import logger
|
4
|
+
from nonebot.matcher import Matcher
|
4
5
|
import struct
|
5
6
|
import httpx
|
6
7
|
import os
|
@@ -15,6 +16,7 @@ from ..l4d2_queries import queries,player_queries
|
|
15
16
|
from ..l4d2_queries.qqgroup import *
|
16
17
|
from ..l4d2_server.workshop import workshop_to_dict
|
17
18
|
from ..l4d2_image.steam import url_to_byte
|
19
|
+
from .txt_to_img import mode_txt_to_img
|
18
20
|
import tempfile
|
19
21
|
import random
|
20
22
|
|
@@ -140,6 +142,7 @@ async def queries_server(msg:list) -> str:
|
|
140
142
|
try:
|
141
143
|
msgs = await queries(ip,port)
|
142
144
|
msgs += await player_queries(ip,port)
|
145
|
+
msgs += f"connect {ip}:{port}"
|
143
146
|
except (struct.error,TimeoutError):
|
144
147
|
pass
|
145
148
|
# except Exception:
|
@@ -304,4 +307,21 @@ async def extract_last_digit(msg: str) -> tuple[str, str]:
|
|
304
307
|
last_digit = msg[i]
|
305
308
|
new_msg = msg[:i]
|
306
309
|
return new_msg, last_digit
|
307
|
-
return msg, ''
|
310
|
+
return msg, ''
|
311
|
+
|
312
|
+
async def str_to_picstr(push_msg:str,matcher:Matcher):
|
313
|
+
"""判断图片输出还是正常输出"""
|
314
|
+
if l4_config.l4_image:
|
315
|
+
lines = push_msg.splitlines()
|
316
|
+
first_str = lines[0]
|
317
|
+
last_str = lines[-1]
|
318
|
+
push_msg = '\n'.join(lines[1:-1])
|
319
|
+
if l4_config.l4_connect:
|
320
|
+
await matcher.send(mode_txt_to_img(first_str,push_msg)+last_str)
|
321
|
+
else:
|
322
|
+
await matcher.send(mode_txt_to_img(first_str,push_msg))
|
323
|
+
else:
|
324
|
+
if l4_config.l4_connect:
|
325
|
+
await matcher.send(push_msg)
|
326
|
+
else:
|
327
|
+
await matcher.send('\n'.join(push_msg.splitlines()[1:-1]))
|
@@ -68,6 +68,9 @@ global_config_form = Form(
|
|
68
68
|
Switch(label='是否优先上传地图', name='l4_only', value='${l4_only}', onText='开启', offText='关闭',
|
69
69
|
labelRemark=Remark(shape='circle',
|
70
70
|
content='开启时,上传地图会保证优先级,从而阻碍其他指令')),
|
71
|
+
Switch(label='是否显示connect', name='l4_connect', value='${l4_connect}', onText='开启', offText='关闭',
|
72
|
+
labelRemark=Remark(shape='circle',
|
73
|
+
content='关闭后,查询服务器将不再显示connect和ip地址')),
|
71
74
|
InputNumber(label='定时推送间隔(min)', name='l4_push_interval', value='${l4_push_interval}',
|
72
75
|
labelRemark=Remark(shape='circle',
|
73
76
|
content='设置好后,使用推送服务器定时指令,将以x分钟为间隔推送一次')),
|
@@ -83,11 +86,11 @@ global_config_form = Form(
|
|
83
86
|
labelRemark=Remark(shape='circle',
|
84
87
|
content='在这里加入的用户,才能上传地图')),
|
85
88
|
|
86
|
-
InputTag(label='
|
89
|
+
InputTag(label='坐牢三指令tag', name='l4_zl_tag', value='${l4_zl_tag}',
|
87
90
|
enableBatchAdd=True,
|
88
91
|
placeholder='添加qq号', visibleOn='${total_enable}', joinValues=False, extractValue=True,
|
89
92
|
labelRemark=Remark(shape='circle',
|
90
|
-
content='
|
93
|
+
content='在这里的指令,可以响应坐牢三指令')),
|
91
94
|
|
92
95
|
],
|
93
96
|
actions=[Action(label='保存', level=LevelEnum.success, type='submit'),
|
{nonebot_plugin_l4d2_server-0.5.6.7.dist-info → nonebot_plugin_l4d2_server-0.5.7.dist-info}/RECORD
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
2
2
|
README.md,sha256=uunm8g1Bs0ynYBN6hH1XHAUoxL_Goru3X0GpnCq_uf4,5683
|
3
|
-
nonebot_plugin_l4d2_server/__init__.py,sha256=
|
3
|
+
nonebot_plugin_l4d2_server/__init__.py,sha256=rK9NF6oDRtbVMxVcxqoaxP14GdnSf9QdaCmP20AmsVU,19815
|
4
4
|
nonebot_plugin_l4d2_server/data/L4D2/image/head/head.png,sha256=Z72PEvp7xF1DZcLDeuWlg2_g6JAfHxtisptWn6BYGN8,158357
|
5
5
|
nonebot_plugin_l4d2_server/data/L4D2/image/header/logo.png,sha256=1KhQNsx7zsCKGHmyIZ65dP9npkKzo7Im-Aafyi5_lhc,631630
|
6
6
|
nonebot_plugin_l4d2_server/data/L4D2/image/header/player1.jpg,sha256=2A_llIi9YVhJs9JOMuF36by7Ewc7P7qOgQS8t5jemNw,405369
|
@@ -27,7 +27,7 @@ nonebot_plugin_l4d2_server/l4d2_data/players.py,sha256=1D6zakDg2FbJqTZ_Y_nxU2nfv
|
|
27
27
|
nonebot_plugin_l4d2_server/l4d2_data/serverip.py,sha256=IXVTCOlpx2yyJ_sRbfKNioMgcTgxpdkwY15M2KMfvoI,1295
|
28
28
|
nonebot_plugin_l4d2_server/l4d2_file/__init__.py,sha256=dWiFJihVKw2jgc6PNltr-8-i82sq6FCJNosxkRaSa_A,4097
|
29
29
|
nonebot_plugin_l4d2_server/l4d2_file/ayromote.py,sha256=SDB8RL8eJzmGTb0olYwoJNw4Z9e4STlHvPDkww5veiQ,1714
|
30
|
-
nonebot_plugin_l4d2_server/l4d2_file/input_json.py,sha256
|
30
|
+
nonebot_plugin_l4d2_server/l4d2_file/input_json.py,sha256=-ClOXJNJ800jbAtwyuA6ML265C6VXM8-HWY1JM4-uWA,1879
|
31
31
|
nonebot_plugin_l4d2_server/l4d2_file/remote.py,sha256=uAcCbDAq9RIookmHl41PfQTpHy0RWMCejx55jCbnTM8,2688
|
32
32
|
nonebot_plugin_l4d2_server/l4d2_image/__init__.py,sha256=8tHdeVqz_bQKaJ1yd45W-plWIewc87cuwgoSfnsU38s,4148
|
33
33
|
nonebot_plugin_l4d2_server/l4d2_image/download.py,sha256=QfPj5cHVGkU-_FsdV9n3IssR5rbgEWB_-FUANCZcSEE,4007
|
@@ -38,7 +38,7 @@ nonebot_plugin_l4d2_server/l4d2_image/send_image_tool.py,sha256=bXZKD6NhVr4FVJd5
|
|
38
38
|
nonebot_plugin_l4d2_server/l4d2_image/steam.py,sha256=_jsz96aw0ie67gE0Y_15qsjqW4tVe4IdC-xg3H0l21c,3799
|
39
39
|
nonebot_plugin_l4d2_server/l4d2_image/vtfs.py,sha256=MawVMrGOrFZ7b8F_XGAMJPvd-grKfbRamDZAWxFXclQ,1387
|
40
40
|
nonebot_plugin_l4d2_server/l4d2_push/__init__.py,sha256=G_zHy8GF4M-YyV4aMVyyWlgOgYarjmNUxp14OwhyOv4,7415
|
41
|
-
nonebot_plugin_l4d2_server/l4d2_queries/__init__.py,sha256
|
41
|
+
nonebot_plugin_l4d2_server/l4d2_queries/__init__.py,sha256=hGnd2dHRRgnSw4Xd0m375BS_RbABVvzMOo4O_0VrE2w,3691
|
42
42
|
nonebot_plugin_l4d2_server/l4d2_queries/api.py,sha256=r-pnXh2ZGyR84M4k5OzYNIWcWD0lq8FmFk6hn7NoQFk,1157
|
43
43
|
nonebot_plugin_l4d2_server/l4d2_queries/ohter.py,sha256=ssq1GKBWa5zrbytmdFwNxr9bSiRyrDTn2aoeb0tGoP0,1191
|
44
44
|
nonebot_plugin_l4d2_server/l4d2_queries/qqgroup.py,sha256=1M5aRtRPMmG6N1CWFnXsKgU5yGiylTi07PJJNk5HRiI,10990
|
@@ -50,16 +50,16 @@ nonebot_plugin_l4d2_server/l4d2_update/__init__.py,sha256=IsoUONi5qQug11FF526pZA
|
|
50
50
|
nonebot_plugin_l4d2_server/l4d2_update/draw_update_log.py,sha256=CxsFztcQIhKsCL4xHTrzFTkbE5miKcJ_jVo457-nyOM,1175
|
51
51
|
nonebot_plugin_l4d2_server/l4d2_update/restart.py,sha256=4xj6awHhhzX_Jh4hWWUpWPQf0bKFXWrPg0w_lhPCNko,2024
|
52
52
|
nonebot_plugin_l4d2_server/l4d2_update/update.py,sha256=79lrF1_G6OFsDWrHJ3CI_s8rk-59MK00ommyslE2qgQ,1434
|
53
|
-
nonebot_plugin_l4d2_server/l4d2_utils/command.py,sha256=
|
54
|
-
nonebot_plugin_l4d2_server/l4d2_utils/config.py,sha256=
|
53
|
+
nonebot_plugin_l4d2_server/l4d2_utils/command.py,sha256=oM6PvjA39o19IjLyhtO92tGc53bmidBxqCUPGHFsGhA,8989
|
54
|
+
nonebot_plugin_l4d2_server/l4d2_utils/config.py,sha256=Or4rxPoKJgpMANnrh903WoHsctwO8EXcGzPP-j2au7g,5960
|
55
55
|
nonebot_plugin_l4d2_server/l4d2_utils/message.py,sha256=vTrTyXWF4fCEH-IlmvKeGv-J7oCkbrXhFwsAHFcivtg,1620
|
56
56
|
nonebot_plugin_l4d2_server/l4d2_utils/rule.py,sha256=j1EEh9PgvFmbq5fQhOonA-3t13wnRM6R44Jkp8hCNQw,337
|
57
57
|
nonebot_plugin_l4d2_server/l4d2_utils/seach.py,sha256=Box5QORfNfpMYDdwNeR309dP1wtivBOxcgrxdJSduSw,992
|
58
58
|
nonebot_plugin_l4d2_server/l4d2_utils/txt_to_img.py,sha256=hzwLVGoOjLAQb3Br43vu1IWW23DuxKW6yTuxMCLhWoY,2133
|
59
|
-
nonebot_plugin_l4d2_server/l4d2_utils/utils.py,sha256=
|
59
|
+
nonebot_plugin_l4d2_server/l4d2_utils/utils.py,sha256=51NQpw99Cf_6Eupx5Hjcsj-yRzTBuKy7Xg9iwFItJuk,9672
|
60
60
|
nonebot_plugin_l4d2_server/l4d2_web/web.py,sha256=3Ryy1JcEUkroS4j8iX_jbcZI5E1cfWbzRSpJXPEFmeE,8575
|
61
|
-
nonebot_plugin_l4d2_server/l4d2_web/webUI.py,sha256=
|
62
|
-
nonebot_plugin_l4d2_server-0.5.
|
63
|
-
nonebot_plugin_l4d2_server-0.5.
|
64
|
-
nonebot_plugin_l4d2_server-0.5.
|
65
|
-
nonebot_plugin_l4d2_server-0.5.
|
61
|
+
nonebot_plugin_l4d2_server/l4d2_web/webUI.py,sha256=qyyUCPe7QDqZdfhGxusx0-fGiYB6NF36tz8_Z9sKzDs,15320
|
62
|
+
nonebot_plugin_l4d2_server-0.5.7.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
63
|
+
nonebot_plugin_l4d2_server-0.5.7.dist-info/METADATA,sha256=AHFjCZC1MZDLwOiEc5vyeNKU_15hqO78y14d-jad50w,7547
|
64
|
+
nonebot_plugin_l4d2_server-0.5.7.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
65
|
+
nonebot_plugin_l4d2_server-0.5.7.dist-info/RECORD,,
|
{nonebot_plugin_l4d2_server-0.5.6.7.dist-info → nonebot_plugin_l4d2_server-0.5.7.dist-info}/LICENSE
RENAMED
File without changes
|
{nonebot_plugin_l4d2_server-0.5.6.7.dist-info → nonebot_plugin_l4d2_server-0.5.7.dist-info}/WHEEL
RENAMED
File without changes
|