nonebot-plugin-l4d2-server 0.3.5a1__py3-none-any.whl → 0.3.5b1__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.
README.md CHANGED
@@ -294,6 +294,20 @@ anne:<br>
294
294
  <details>
295
295
  <summary>展开/收起</summary>
296
296
 
297
+ ### 0.3.5--2022.3
298
+
299
+ - 新增ping查询(在ip里包括)
300
+ - 新增api查询(未完成)
301
+
302
+ ### 0.3.4--2022.3.1
303
+
304
+ - 新增本地插件smx查询
305
+ - 增加了三个内置群服
306
+ - 修改了图片的UI,变好看了
307
+ - 删减了部分图片和字体,使得轻量化
308
+ - 修复了海量bug
309
+ - 修复了python3.8中typing错误
310
+
297
311
  ### 0.3.3--2022.2.26
298
312
 
299
313
  - 重写协议,使用a2s库,同时解决win端不同报错无法输出
@@ -29,6 +29,7 @@ from .l4d2_image.vtfs import img_to_vtf
29
29
  from .l4d2_queries.ohter import load_josn
30
30
  from .l4d2_queries.qqgroup import write_json,ip_anne_list
31
31
  from .l4d2_file import updown_l4d2_vpk,all_zip_to_one
32
+ from .l4d2_queries.maps import seach_map,map_dict_to_str
32
33
  from .txt_to_img import mode_txt_to_img
33
34
  # from .l4d2_server import RCONClient
34
35
  from nonebot import get_bot, require
@@ -453,6 +454,19 @@ async def _():
453
454
  msg = mes_list(msg,name_smx).replace(" ","")
454
455
  await find_vpk.finish(mode_txt_to_img(mes,msg))
455
456
 
457
+ @search_api.handle()
458
+ async def _(args:Message = CommandArg()):
459
+ msg:str = args.extract_plain_text()
460
+ # if msg.startswith('代码'):
461
+ # 建图代码返回三方图信息
462
+ data = await seach_map(msg,l4_master[0],l4_key)
463
+ # else:
464
+ if type(data) == str:
465
+ await search_api.finish(data)
466
+ else:
467
+ await search_api.finish(await map_dict_to_str(data))
468
+
469
+
456
470
  @driver.on_shutdown
457
471
  async def close_db():
458
472
  """关闭数据库"""
@@ -86,6 +86,7 @@ show_queries = on_command('showq',aliases={"求生订阅"},priority=20,block=Tru
86
86
  join_server = on_command('showq',aliases={"求生加入"},priority=20,block=True)
87
87
  connect_rcon = on_command("Rrcon", aliases={"求生连接", '求生链接','求生rcon'}, priority=50, block=False)
88
88
  end_connect = ['stop', '结束', '连接结束', '结束连接']
89
+ search_api = on_command('search',aliases={'求生三方'}, priority=50, block=True)
89
90
 
90
91
 
91
92
  # 下载内容
@@ -89,6 +89,11 @@ try:
89
89
  except:
90
90
  l4_style:str = ''
91
91
 
92
+ try:
93
+ l4_key:str = nonebot.get_driver().config.l4_key
94
+ except:
95
+ l4_key:str = ""
96
+
92
97
  l4_list = [l4_file, l4_steamid, l4_host, l4_port, l4_rcon, l4_master]
93
98
  l4_list = [ast.literal_eval(i) if isinstance(i, str) else i for i in l4_list]
94
99
  l4_file, l4_steamid, l4_host, l4_port, l4_rcon, l4_master = l4_list
@@ -7,7 +7,7 @@ async def queries(ip:str,port:int):
7
7
  message = 'ip:' + msg_dict['ip'] + '\n'
8
8
  message += '名称:' + msg_dict['name'] + '\n'
9
9
  message += f"地图:{msg_dict['map_']}\n"
10
- message += f"Ping:{msg_dict['ping']}\n"
10
+ message += f"延迟:{msg_dict['ping']}\n"
11
11
  message += f"玩家:{msg_dict['players']} / {msg_dict['max_players']}\n"
12
12
  return message
13
13
 
@@ -0,0 +1,27 @@
1
+ import httpx
2
+
3
+
4
+ async def seach_map(msg:str,qq:str,key:str):
5
+ url = "http://106.13.207.45:4015/l4d2"
6
+ json = {
7
+ "mode":"zh",
8
+ "map_name":msg,
9
+ "qq":qq,
10
+ "key":key
11
+ }
12
+ print(json)
13
+ file = httpx.post(url,json=json)
14
+ if file.status_code == 200:
15
+ return file.json()
16
+ elif file.status_code == 204:
17
+ return "没有结果"
18
+ elif file.status_code == 406:
19
+ return "参数错误"
20
+ elif file.status_code == 401:
21
+ return file.json()
22
+
23
+ async def map_dict_to_str(data:dict):
24
+ msg = ""
25
+ for key,value in data[0].items():
26
+ msg += f"{key}:{value}\n"
27
+ return msg
@@ -248,9 +248,11 @@ async def write_json(data_str:str):
248
248
  return '序号不正确,请输入【求生更新 删除 腐竹 序号】'
249
249
  return '腐竹名不存在,请输入【求生更新 删除 腐竹 序号】'
250
250
 
251
-
252
- ips = ALL_HOST['云']
253
- ip_anne_list = []
254
- for one_ip in ips:
255
- host,port = split_maohao(one_ip['ip'])
256
- ip_anne_list.append((one_ip['id'],host,port))
251
+ try:
252
+ ips = ALL_HOST['云']
253
+ ip_anne_list = []
254
+ for one_ip in ips:
255
+ host,port = split_maohao(one_ip['ip'])
256
+ ip_anne_list.append((one_ip['id'],host,port))
257
+ except KeyError:
258
+ pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nonebot-plugin-l4d2-server
3
- Version: 0.3.5a1
3
+ Version: 0.3.5b1
4
4
  Summary: L4D2 server related operations plugin for NoneBot
5
5
  Home-page: https://github.com/Umamusume-Agnes-Digital/nonebot_plugin_l4d2_server
6
6
  License: MIT
@@ -337,6 +337,20 @@ anne:<br>
337
337
  <details>
338
338
  <summary>展开/收起</summary>
339
339
 
340
+ ### 0.3.5--2022.3
341
+
342
+ - 新增ping查询(在ip里包括)
343
+ - 新增api查询(未完成)
344
+
345
+ ### 0.3.4--2022.3.1
346
+
347
+ - 新增本地插件smx查询
348
+ - 增加了三个内置群服
349
+ - 修改了图片的UI,变好看了
350
+ - 删减了部分图片和字体,使得轻量化
351
+ - 修复了海量bug
352
+ - 修复了python3.8中typing错误
353
+
340
354
  ### 0.3.3--2022.2.26
341
355
 
342
356
  - 重写协议,使用a2s库,同时解决win端不同报错无法输出
@@ -1,7 +1,7 @@
1
1
  LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
2
- nonebot_plugin_l4d2_server/__init__.py,sha256=-pNoCRz4MHflw5AIoBJe3rBtwA0rOHHNGBbBm8VMNXA,16895
3
- nonebot_plugin_l4d2_server/command.py,sha256=ZjjBCSERsSYvbsBP5FSKfpT9ng3zhgGwQwQ2dFi_HEM,4974
4
- nonebot_plugin_l4d2_server/config.py,sha256=nXfbAAS7EhxFNIS61vdXXmGbYfNEj1wCB19i3eh5bK4,3959
2
+ nonebot_plugin_l4d2_server/__init__.py,sha256=JJeOO4zcV_p-XFlUWpn_YwUa1NW3KJ5THDM5mIi2qNQ,17361
3
+ nonebot_plugin_l4d2_server/command.py,sha256=DLI5A_tNH_ZNoH1qERK854yFkws5FVa_45c3rzXZKPo,5059
4
+ nonebot_plugin_l4d2_server/config.py,sha256=CBbWzE5PQnY6AESykoiKyRFzTrJ5cm_3ZniNxZcSfhE,4050
5
5
  nonebot_plugin_l4d2_server/data/L4D2/image/head/head.png,sha256=Z72PEvp7xF1DZcLDeuWlg2_g6JAfHxtisptWn6BYGN8,158357
6
6
  nonebot_plugin_l4d2_server/data/L4D2/image/header/player1.jpg,sha256=2A_llIi9YVhJs9JOMuF36by7Ewc7P7qOgQS8t5jemNw,405369
7
7
  nonebot_plugin_l4d2_server/data/L4D2/image/template/anne.html,sha256=oFpQfCIN0CKoEfjAb8aUOYD7l-kmPd1qCSF8E6bosY8,1567
@@ -27,9 +27,10 @@ nonebot_plugin_l4d2_server/l4d2_image/htmlimg.py,sha256=bz1oJn-CUoPuBktJxGLrm1Fs
27
27
  nonebot_plugin_l4d2_server/l4d2_image/send_image_tool.py,sha256=DKliVudSSeec4Gl5Deji04-P4_bbSIvXWorEIPQpKDc,968
28
28
  nonebot_plugin_l4d2_server/l4d2_image/steam.py,sha256=-N0dcTmnCu5UOjUik0UMWR3pTlCQK7PnkxGuZpju-TU,2481
29
29
  nonebot_plugin_l4d2_server/l4d2_image/vtfs.py,sha256=2WuXE_4_5eVNExzYCTgZnKZrcE6CxqnDpjpKEA_FHCE,1427
30
- nonebot_plugin_l4d2_server/l4d2_queries/__init__.py,sha256=L4mHayvwONh0TjEwvSxdKqzyBvVY9QwJA4utK_BjN7I,3466
30
+ nonebot_plugin_l4d2_server/l4d2_queries/__init__.py,sha256=Qv3aIDaqbP2J5zUXiOnfl9eJ1o0WKeGnC1qzOqfDgDo,3468
31
+ nonebot_plugin_l4d2_server/l4d2_queries/maps.py,sha256=EcyHLVIa801qADz1zO-TZwSdQpr4aHZEGz_M-UeDQQ4,669
31
32
  nonebot_plugin_l4d2_server/l4d2_queries/ohter.py,sha256=HQzsbk10L5nUrPAaN-FvCJO9kmfOyXz8nrnZZezg8Ss,888
32
- nonebot_plugin_l4d2_server/l4d2_queries/qqgroup.py,sha256=ylFSFYS8bSEyeOMDvF9daPX3MdwO28bPhIxoW3A5ZBQ,10175
33
+ nonebot_plugin_l4d2_server/l4d2_queries/qqgroup.py,sha256=8fPLw5deTJXGKwgXUQSl1RZ_hmC9NhvEKFnXL7IAOaA,10227
33
34
  nonebot_plugin_l4d2_server/l4d2_server/__init__.py,sha256=mp3Za6jJ-V92ChXRhl3k4D1tMTY4dqHdXgMzdWutccc,1676
34
35
  nonebot_plugin_l4d2_server/l4d2_server/rcon.py,sha256=aP2n-sq_vM-h6UjnNCmKK9_WW8oS9zFySgowPl5FXd4,1160
35
36
  nonebot_plugin_l4d2_server/l4d2_server/workshop.py,sha256=ZpWnWJ7EABNpDu86Rzoqu3tWoABanprIEcmej1zUT1A,1409
@@ -37,8 +38,8 @@ nonebot_plugin_l4d2_server/message.py,sha256=x_ts0HaW3SNOma-baEG0oaeozKE5Nh_fybn
37
38
  nonebot_plugin_l4d2_server/seach.py,sha256=FOtFWYVWNxt-tMFXdVN7_F1vBTKlTDdRljoUWFQzB9w,1021
38
39
  nonebot_plugin_l4d2_server/txt_to_img.py,sha256=ZaxHYNu8aAZUH4fNALyE1Q_ET7KuWytEiMFZ9loZnqc,2188
39
40
  nonebot_plugin_l4d2_server/utils.py,sha256=7hPjQLLhBCjiOCcKA7KAfiLimRx940iWaugD3dnaNCA,8348
40
- README.md,sha256=xQ63Y_xBl7OV1yiJ-Vbsbv3DWllIy6zN907oWqSXdKk,16458
41
- nonebot_plugin_l4d2_server-0.3.5a1.dist-info/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
42
- nonebot_plugin_l4d2_server-0.3.5a1.dist-info/METADATA,sha256=ZgR7HiLW8_YVVUI_XBXD-lBPTlzpYwy_Y60oKKZvO-c,17860
43
- nonebot_plugin_l4d2_server-0.3.5a1.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
44
- nonebot_plugin_l4d2_server-0.3.5a1.dist-info/RECORD,,
41
+ README.md,sha256=M9oUOc4iRX8XGJNTj_QFM0lzkpv_duBDYylRnatUy18,16798
42
+ nonebot_plugin_l4d2_server-0.3.5b1.dist-info/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
43
+ nonebot_plugin_l4d2_server-0.3.5b1.dist-info/METADATA,sha256=QwMBJrXv5aa16o0vhjSNEwlqaFEkOpyPeY5CB1hZOOs,18186
44
+ nonebot_plugin_l4d2_server-0.3.5b1.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
45
+ nonebot_plugin_l4d2_server-0.3.5b1.dist-info/RECORD,,