nonebot-plugin-l4d2-server 0.3.5a0__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
@@ -3,7 +3,7 @@
3
3
  <link rel="stylesheet" type="text/css" href="vue.css">
4
4
  </head>
5
5
  </br>
6
- <body style="background-image: url('back.png');">
6
+ <body style="background-image: url('back.png'); background-size: cover;">
7
7
  {% for item in data %}
8
8
  <h1 ><center>求生药役anne电信服数据</center></h1>
9
9
  <div class="scissors" style="border-top:1px dashed orange;">
@@ -1,136 +1,4 @@
1
1
  {
2
- "云": [
3
- {
4
- "id": 1,
5
- "version": "anne",
6
- "ip": "124.221.215.53:2332"
7
- },
8
- {
9
- "id": 2,
10
- "version": "anne",
11
- "ip": "43.143.158.196:2331"
12
- },
13
- {
14
- "id": 3,
15
- "version": "anne",
16
- "ip": "106.55.6.211:2332"
17
- },
18
- {
19
- "id": 4,
20
- "version": "anne",
21
- "ip": "106.55.6.211:2333"
22
- },
23
- {
24
- "id": 5,
25
- "version": "anne",
26
- "ip": "106.13.221.250:2330"
27
- },
28
- {
29
- "id": 6,
30
- "version": "anne",
31
- "ip": "106.13.221.250:2334"
32
- },
33
- {
34
- "id": 7,
35
- "version": "anne",
36
- "ip": "119.91.25.89:2331"
37
- },
38
- {
39
- "id": 8,
40
- "version": "anne",
41
- "ip": "119.91.25.89:2332"
42
- },
43
- {
44
- "id": 9,
45
- "version": "anne",
46
- "ip": "119.91.25.89:2333"
47
- },
48
- {
49
- "id": 10,
50
- "version": "anne",
51
- "ip": "119.91.25.89:2334"
52
- },
53
- {
54
- "id": 11,
55
- "version": "anne",
56
- "ip": "82.157.142.166:2331"
57
- },
58
- {
59
- "id": 12,
60
- "version": "anne",
61
- "ip": "82.157.142.166:2332"
62
- },
63
- {
64
- "id": 13,
65
- "version": "anne",
66
- "ip": "82.157.142.166:2333"
67
- },
68
- {
69
- "id": 14,
70
- "version": "anne",
71
- "ip": "82.157.142.166:2334"
72
- },
73
- {
74
- "id": 15,
75
- "version": "anne",
76
- "ip": "47.98.100.49:2330"
77
- },
78
- {
79
- "id": 16,
80
- "version": "anne",
81
- "ip": "47.98.100.49:2334"
82
- },
83
- {
84
- "id": 17,
85
- "version": "anne",
86
- "ip": "43.143.158.196:2332"
87
- },
88
- {
89
- "id": 18,
90
- "version": "anne",
91
- "ip": "g3.kok.wang:40024"
92
- },
93
- {
94
- "id": 19,
95
- "version": "anne",
96
- "ip": "g3.kok.wang:40025"
97
- },
98
- {
99
- "id": 20,
100
- "version": "anne",
101
- "ip": "g3.kok.wang:40026"
102
- },
103
- {
104
- "id": 21,
105
- "version": "anne",
106
- "ip": "g3.kok.wang:40027"
107
- },
108
- {
109
- "id": 22,
110
- "version": "anne",
111
- "ip": "121.62.61.229:2331"
112
- },
113
- {
114
- "id": 23,
115
- "version": "anne",
116
- "ip": "121.62.61.229:2332"
117
- },
118
- {
119
- "id": 24,
120
- "version": "anne",
121
- "ip": "124.221.10.99:2334"
122
- },
123
- {
124
- "id": 25,
125
- "version": "anne",
126
- "ip": "43.248.188.11:27022"
127
- },
128
- {
129
- "id": 26,
130
- "version": "anne",
131
- "ip": "43.248.188.11:27023"
132
- }
133
- ],
134
2
  "呆呆": [
135
3
  {
136
4
  "id": 1,
@@ -133,7 +133,7 @@ def anne_rank_dict(name:str):
133
133
  headers = {
134
134
  'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0'
135
135
  }
136
- data = httpx.get(url,headers=headers,timeout=30).content.decode('utf-8')
136
+ data = httpx.get(url,headers=headers,timeout=5).content.decode('utf-8')
137
137
  data = BeautifulSoup(data, 'html.parser')
138
138
  detail = data.find_all('table')
139
139
  n = 0
@@ -7,6 +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"延迟:{msg_dict['ping']}\n"
10
11
  message += f"玩家:{msg_dict['players']} / {msg_dict['max_players']}\n"
11
12
  return message
12
13
 
@@ -23,11 +24,12 @@ async def queries_dict(ip:str,port:int) -> dict:
23
24
  msg_dict['players'] = msg.player_count
24
25
  msg_dict['max_players'] = msg.max_players
25
26
  msg_dict['ip'] = str(ip) + ':' +str(port)
26
- msg_dict['ping'] = str(msg.ping)
27
+ msg_dict['ping'] = f"{msg.ping*1000:.0f}ms"
27
28
  if msg_dict['players'] < msg_dict['max_players']:
28
29
  msg_dict['enabled'] = True
29
30
  else:
30
31
  msg_dict['enabled'] = False
32
+ print(msg_dict)
31
33
  return msg_dict
32
34
 
33
35
  async def player_queries_anne_dict(ip:str,port:int):
@@ -74,6 +76,7 @@ async def msg_ip_to_list(message_list:list):
74
76
  max_duration_len = max([len(str(i['Duration'])) for i in message_list])
75
77
  max_score_len = max([len(str(i['Score'])) for i in message_list])
76
78
  for i in message_list:
79
+ print(i)
77
80
  n += 1
78
81
  name = i['name']
79
82
  Score = i['Score']
@@ -83,7 +86,6 @@ async def msg_ip_to_list(message_list:list):
83
86
  soc = "[{:>{}}]".format(Score,max_score_len)
84
87
  dur = "{:^{}}".format(Duration, max_duration_len)
85
88
  message += f'{soc} | {dur} | {name} \n'
86
- message += i['ping'] + '\n'
87
89
  return message
88
90
 
89
91
  async def convert_duration(duration: int) -> str:
@@ -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
@@ -222,7 +222,7 @@ async def save_file(file:bytes,path_name):
222
222
  files.write(file)
223
223
 
224
224
  async def get_anne_server_ip(ip):
225
- """输出查询ip"""
225
+ """输出查询ip和ping"""
226
226
  host,port = split_maohao(ip)
227
227
  data = await queries_server([host,port])
228
228
  lines = data.splitlines()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nonebot-plugin-l4d2-server
3
- Version: 0.3.5a0
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,19 +1,19 @@
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
- nonebot_plugin_l4d2_server/data/L4D2/image/template/anne.html,sha256=lHU5p2zS8rxiJW8omqVZtgWUXdgG1d9h5_o68of0ip0,1543
8
- nonebot_plugin_l4d2_server/data/L4D2/image/template/back.png,sha256=2QUvYzGL8NQtURbRZFT9SXBT2rYjd1z-OVSoAF80fD4,1529483
7
+ nonebot_plugin_l4d2_server/data/L4D2/image/template/anne.html,sha256=oFpQfCIN0CKoEfjAb8aUOYD7l-kmPd1qCSF8E6bosY8,1567
8
+ nonebot_plugin_l4d2_server/data/L4D2/image/template/back.png,sha256=tFXhpNiFnbTZiEF9Z2O2EjxCxcrhsFJH4po8Cb7SnIg,242997
9
9
  nonebot_plugin_l4d2_server/data/L4D2/image/template/fingerprint.svg,sha256=AwLa0b5WQjuatlNF4ob1sTJk2ZG3bi4S46AgoNbs10U,2150
10
10
  nonebot_plugin_l4d2_server/data/L4D2/image/template/help - 副本.html,sha256=oHrIGU9bCTG1rFelUm7aLWHvsjRKI0fimW1srjewOVw,5829
11
11
  nonebot_plugin_l4d2_server/data/L4D2/image/template/help.html,sha256=TomooDmqUmqcIyioyNsCdkxOQGCYkw3u12F9IYO1c7Q,6214
12
12
  nonebot_plugin_l4d2_server/data/L4D2/image/template/help_dack.html,sha256=g7tp8g_ZejiQBQrOti-EvcygJBFICnscU5ckrJ5Lp2A,6417
13
13
  nonebot_plugin_l4d2_server/data/L4D2/image/template/ip.html,sha256=5uNt3wigNdAZX2gNX4nFOJghbXoiBJoceGyV5qcK9Xg,1595
14
14
  nonebot_plugin_l4d2_server/data/L4D2/image/template/vue.css,sha256=2sGjCFrR-3tFMB_x7l4K6k40tZ5JVzhWqD759cagYBA,7874
15
- nonebot_plugin_l4d2_server/data/L4D2/l4d2.json,sha256=TOYMSDi67z-CiZyyoECs4AKanLF78MU1-ckf-emzIXo,5087
16
- nonebot_plugin_l4d2_server/l4d2_anne/__init__.py,sha256=9yBe1X1jy6Ka5j2518v8kaxQX_Q9HMLqXUXl88uH9RI,7771
15
+ nonebot_plugin_l4d2_server/data/L4D2/l4d2.json,sha256=spA4v-ZT_GtJH4BZ63mCWQf_38RBjqAgARfBaHH9Gds,2140
16
+ nonebot_plugin_l4d2_server/l4d2_anne/__init__.py,sha256=QEceM8gXwo6kQn_kO7g7tUqEU1D5v2iWYRZwl8bJm_4,7770
17
17
  nonebot_plugin_l4d2_server/l4d2_anne/anne_telecom.py,sha256=0U1iY4vSY5yyM3vrMWl2wDO_KFKi4KFRxjAuPuFdO3o,2958
18
18
  nonebot_plugin_l4d2_server/l4d2_anne/server.py,sha256=Y1Pss8hU1vkJepKCf9hoSShhbDT_hWrSJknW3AFJDu4,1686
19
19
  nonebot_plugin_l4d2_server/l4d2_data/__init__.py,sha256=1JDSuJ1mCF_zIZZfvD-O1JZCgQ2ju_EH0Y3k6oLr2j4,3332
@@ -27,18 +27,19 @@ 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=vZjCpQA5ckXjzaUeMkDj07N7PXp1P-8H9a1LEj2mdpA,3398
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
36
37
  nonebot_plugin_l4d2_server/message.py,sha256=x_ts0HaW3SNOma-baEG0oaeozKE5Nh_fybnRH6VE8i0,1678
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
- nonebot_plugin_l4d2_server/utils.py,sha256=BHz3AilifNcS2FP42SDWcRRB1GTKp9HvhHoqgavDLUU,8341
40
- README.md,sha256=xQ63Y_xBl7OV1yiJ-Vbsbv3DWllIy6zN907oWqSXdKk,16458
41
- nonebot_plugin_l4d2_server-0.3.5a0.dist-info/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
42
- nonebot_plugin_l4d2_server-0.3.5a0.dist-info/METADATA,sha256=dGvFl8XbSY1OKpbSzGtKVfqqKbObGTp6Ynj-Pb3qP6g,17860
43
- nonebot_plugin_l4d2_server-0.3.5a0.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
44
- nonebot_plugin_l4d2_server-0.3.5a0.dist-info/RECORD,,
40
+ nonebot_plugin_l4d2_server/utils.py,sha256=7hPjQLLhBCjiOCcKA7KAfiLimRx940iWaugD3dnaNCA,8348
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,,