nonebot-plugin-l4d2-server 0.4.7__py3-none-any.whl → 0.4.8__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
@@ -115,6 +115,11 @@ _✨Nonebot & Left 4 Dead 2 server操作✨_
115
115
  <details>
116
116
  <summary>展开/收起</summary>
117
117
 
118
+ ### 0.4.8--2022.4.16
119
+
120
+ - 新增重载ip
121
+ - 修复了一些windows启动下奇奇怪怪的bug
122
+
118
123
  ### 0.4.7--2022.4.13
119
124
 
120
125
  - 新增模式查询
@@ -47,7 +47,7 @@ else:
47
47
  driver = get_driver()
48
48
 
49
49
 
50
- __version__ = "0.4.7"
50
+ __version__ = "0.4.8"
51
51
  __plugin_meta__ = PluginMetadata(
52
52
  name="求生之路小助手",
53
53
  description='群内对有关求生之路的查询和操作',
@@ -453,6 +453,16 @@ async def _(matcher:Matcher,bot:Bot,event:GroupMessageEvent,state:T_State):
453
453
  else:
454
454
  await matcher.finish('已取消上传')
455
455
 
456
+ @reload_ip.handle()
457
+ async def _(matcher:Matcher):
458
+ global matchers
459
+ await matcher.send('正在重载ip,可能需要一点时间')
460
+ for _, l4_matchers in matchers.items():
461
+ for l4_matcher in l4_matchers:
462
+ l4_matcher.destroy()
463
+ await get_des_ip()
464
+ await matcher.finish('已重载ip')
465
+
456
466
 
457
467
  @driver.on_shutdown
458
468
  async def close_db():
@@ -1,7 +1,8 @@
1
1
  import re
2
2
  import asyncio
3
+ from typing import Type
3
4
 
4
- from nonebot import on_notice,on_command,on_regex,on_keyword
5
+ from nonebot import on_notice,on_command,on_regex,on_keyword,MatcherGroup
5
6
  from nonebot.params import CommandArg,RawCommand,CommandStart
6
7
  from nonebot.matcher import Matcher
7
8
  import nonebot
@@ -72,10 +73,6 @@ prison = on_command('zl',aliases={'坐牢'},priority=20,block=True)
72
73
  open_prison = on_command('kl',aliases={'开牢'},priority=20,block=True)
73
74
 
74
75
  updata = on_command('updata',aliases={'求生更新'},priority=20,block=True,permission= Master)
75
- def reload_ip():
76
- global updata,get_ip
77
- updata = on_command('updata',aliases={'求生更新'},priority=20,block=True,permission= Master)
78
- get_ip = on_command('114514919181',aliases=server_key(),priority=80,block=True)
79
76
  tan_jian = on_command('tj',aliases={'探监'},priority=20,block=True)
80
77
 
81
78
  # 查询
@@ -88,6 +85,7 @@ connect_rcon = on_command("Rrcon", aliases={"求生连接", '求生链接','求
88
85
  end_connect = ['stop', '结束', '连接结束', '结束连接']
89
86
  search_api = on_command('search',aliases={'求生三方'}, priority=20, block=True,permission= Master)
90
87
  which_map = on_keyword(("是什么图"),priority=20, block=False)
88
+ reload_ip = on_command('l4_reload',aliases={'重载ip'},priority=30,permission=Master)
91
89
 
92
90
  # 下载内容
93
91
  up_workshop = on_command('workshop',aliases={'创意工坊下载','求生创意工坊'},priority=20,block=True)
@@ -116,16 +114,19 @@ def get_session_id(event: MessageEvent) -> str:
116
114
  else:
117
115
  return f"private_{event.user_id}"
118
116
 
117
+ matchers: Dict[str, List[Type[Matcher]]] = {}
119
118
 
120
- @driver.on_startup
121
- async def _():
119
+
120
+
121
+ async def get_des_ip():
122
122
  global ALL_HOST
123
123
  global ANNE_IP
124
+ global matchers
124
125
  if l4_tag == None:
125
126
  pass
126
127
  else:
127
128
  ALL_HOST.update(await seach_map(l4_tag,l4_qq,l4_key,'ip'))
128
- def count_ips(ip_dict:dict):
129
+ async def count_ips(ip_dict:dict):
129
130
  global ANNE_IP
130
131
  for key, value in ip_dict.items():
131
132
  if key in ['error_','success_']:
@@ -136,7 +137,7 @@ async def _():
136
137
  if key == '云':
137
138
  ANNE_IP = {key:value}
138
139
 
139
- count_ips(ALL_HOST)
140
+ await count_ips(ALL_HOST)
140
141
  ip_anne_list=[]
141
142
  try:
142
143
  ips = ALL_HOST['云']
@@ -146,10 +147,14 @@ async def _():
146
147
  ip_anne_list.append((one_ip['id'],host,port))
147
148
  except KeyError:
148
149
  pass
149
-
150
+
151
+
150
152
  get_ip = on_command('anne',aliases=server_key(),priority=80,block=True)
151
153
  @get_ip.handle()
152
- async def _(matcher:Matcher,start:str = CommandStart(),command: str = RawCommand(),args:Message = CommandArg(),):
154
+ async def _(matcher:Matcher,start:str = CommandStart(),command: str = RawCommand(),args:Message = CommandArg()):
155
+ if get_ip.plugin_name not in matchers:
156
+ matchers[get_ip.plugin_name] = []
157
+ matchers[get_ip.plugin_name].append(get_ip)
153
158
  if start:
154
159
  command = command.replace(start,'')
155
160
  if command == 'anne':
@@ -191,7 +196,8 @@ async def _():
191
196
  await matcher.finish(msg)
192
197
  except (OSError,asyncio.exceptions.TimeoutError):
193
198
  await matcher.finish('服务器无响应')
194
-
199
+
200
+
195
201
  @tan_jian.handle()
196
202
  async def _(matcher:Matcher,event:MessageEvent):
197
203
  msg = await get_tan_jian(ip_anne_list,1)
@@ -206,4 +212,17 @@ async def _():
206
212
  async def _(matcher:Matcher,event:MessageEvent):
207
213
 
208
214
  msg = await get_tan_jian(ip_anne_list,3)
209
- await matcher.finish(msg)
215
+ await matcher.finish(msg)
216
+
217
+
218
+
219
+ async def init():
220
+ global matchers
221
+
222
+ await get_des_ip()
223
+ print('启动辣')
224
+
225
+
226
+ @driver.on_startup
227
+ async def _():
228
+ await init()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nonebot-plugin-l4d2-server
3
- Version: 0.4.7
3
+ Version: 0.4.8
4
4
  Summary: L4D2 server related operations plugin for NoneBot2
5
5
  Home-page: https://github.com/Agnes4m/nonebot_plugin_l4d2_server
6
6
  License: GPLv3
@@ -162,6 +162,11 @@ _✨Nonebot & Left 4 Dead 2 server操作✨_
162
162
  <details>
163
163
  <summary>展开/收起</summary>
164
164
 
165
+ ### 0.4.8--2022.4.16
166
+
167
+ - 新增重载ip
168
+ - 修复了一些windows启动下奇奇怪怪的bug
169
+
165
170
  ### 0.4.7--2022.4.13
166
171
 
167
172
  - 新增模式查询
@@ -1,6 +1,6 @@
1
1
  LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
2
- nonebot_plugin_l4d2_server/__init__.py,sha256=e1czD-zi7cToD-xWwE4VavFuWHL5MefVga3__SoDOGo,16832
3
- nonebot_plugin_l4d2_server/command.py,sha256=EGRnYx0mb6wo5zBz77wilAsVYIvooTQn07XrItEC-fg,8320
2
+ nonebot_plugin_l4d2_server/__init__.py,sha256=8RbJmcQKddzf3leH9mP7ojBMvgk3Ze3mc2B6DyRrxg4,17164
3
+ nonebot_plugin_l4d2_server/command.py,sha256=ifm_Bir28r7IHmbnBP9R_R5RkJDC-7rfa5WjqojAiog,8619
4
4
  nonebot_plugin_l4d2_server/config.py,sha256=izdgpdcoY_zg_rylcM6jGAzr1e2lK4FJ81s0ITshtz0,5046
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/logo.png,sha256=1KhQNsx7zsCKGHmyIZ65dP9npkKzo7Im-Aafyi5_lhc,631630
@@ -42,8 +42,8 @@ nonebot_plugin_l4d2_server/message.py,sha256=x_ts0HaW3SNOma-baEG0oaeozKE5Nh_fybn
42
42
  nonebot_plugin_l4d2_server/seach.py,sha256=dsusYogKH9pGeLxZz9BTheQwtJ3wAO3tfbePYdcaIuA,1025
43
43
  nonebot_plugin_l4d2_server/txt_to_img.py,sha256=evJeuKWSHbg8EWnUdeqHoNbxE5yOORVWXJwMWO1PKTo,2166
44
44
  nonebot_plugin_l4d2_server/utils.py,sha256=OywrH2CQHZo-OMkLxFZV70qN5_KpvZ-Ox3IlizVUENo,8297
45
- README.md,sha256=rGRkmXP-GUxqqlz-BGb7TzdQlCiQlfcOmwMKz5KbCRU,11486
46
- nonebot_plugin_l4d2_server-0.4.7.dist-info/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
47
- nonebot_plugin_l4d2_server-0.4.7.dist-info/METADATA,sha256=5avjRgAx0ryke7TV78IzjSV77ggsXQ_o5TfJPKNnHZo,13142
48
- nonebot_plugin_l4d2_server-0.4.7.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
49
- nonebot_plugin_l4d2_server-0.4.7.dist-info/RECORD,,
45
+ README.md,sha256=kgtvxyze7CvBpFJEP4o6BbzkOQnP3AGVO22Tj6dK788,11585
46
+ nonebot_plugin_l4d2_server-0.4.8.dist-info/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
47
+ nonebot_plugin_l4d2_server-0.4.8.dist-info/METADATA,sha256=u_4-SPNN71DRR_i4JSU3AjYfbypkYvR6i0Hlf4D8lJk,13236
48
+ nonebot_plugin_l4d2_server-0.4.8.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
49
+ nonebot_plugin_l4d2_server-0.4.8.dist-info/RECORD,,