nonebot-plugin-l4d2-server 0.5.1__py3-none-any.whl → 0.5.2__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.
- LICENSE +674 -674
- README.md +364 -359
- nonebot_plugin_l4d2_server/__init__.py +1 -1
- nonebot_plugin_l4d2_server/chrome.py +44 -44
- nonebot_plugin_l4d2_server/command.py +232 -232
- nonebot_plugin_l4d2_server/config.py +210 -210
- nonebot_plugin_l4d2_server/data/L4D2/image/template/anne.html +60 -60
- nonebot_plugin_l4d2_server/data/L4D2/image/template/fingerprint.svg +15 -15
- nonebot_plugin_l4d2_server/data/L4D2/image/template/help.html +233 -233
- nonebot_plugin_l4d2_server/data/L4D2/image/template/help_dack.html +231 -231
- nonebot_plugin_l4d2_server/data/L4D2/image/template/ip.html +48 -48
- nonebot_plugin_l4d2_server/data/L4D2/image/template/l.svg +9 -9
- nonebot_plugin_l4d2_server/l4d2_anne/__init__.py +251 -251
- nonebot_plugin_l4d2_server/l4d2_anne/analysis.py +51 -51
- nonebot_plugin_l4d2_server/l4d2_anne/anne_telecom.py +75 -75
- nonebot_plugin_l4d2_server/l4d2_anne/server.py +65 -65
- nonebot_plugin_l4d2_server/l4d2_anne/startand.py +17 -17
- nonebot_plugin_l4d2_server/l4d2_data/__init__.py +91 -91
- nonebot_plugin_l4d2_server/l4d2_data/config.py +17 -17
- nonebot_plugin_l4d2_server/l4d2_data/players.py +87 -87
- nonebot_plugin_l4d2_server/l4d2_data/serverip.py +32 -32
- nonebot_plugin_l4d2_server/l4d2_file/__init__.py +122 -122
- nonebot_plugin_l4d2_server/l4d2_file/ayromote.py +56 -56
- nonebot_plugin_l4d2_server/l4d2_file/remote.py +63 -63
- nonebot_plugin_l4d2_server/l4d2_image/__init__.py +103 -103
- nonebot_plugin_l4d2_server/l4d2_image/download.py +101 -101
- nonebot_plugin_l4d2_server/l4d2_image/htmlimg.py +32 -32
- nonebot_plugin_l4d2_server/l4d2_image/send_image_tool.py +32 -32
- nonebot_plugin_l4d2_server/l4d2_image/steam.py +83 -83
- nonebot_plugin_l4d2_server/l4d2_image/vtfs.py +40 -40
- nonebot_plugin_l4d2_server/l4d2_queries/__init__.py +114 -114
- nonebot_plugin_l4d2_server/l4d2_queries/api.py +43 -43
- nonebot_plugin_l4d2_server/l4d2_queries/ohter.py +35 -35
- nonebot_plugin_l4d2_server/l4d2_queries/qqgroup.py +288 -288
- nonebot_plugin_l4d2_server/l4d2_server/__init__.py +61 -61
- nonebot_plugin_l4d2_server/l4d2_server/rcon.py +28 -28
- nonebot_plugin_l4d2_server/l4d2_server/workshop.py +50 -50
- nonebot_plugin_l4d2_server/l4d2_web/web.py +234 -252
- nonebot_plugin_l4d2_server/l4d2_web/webUI.py +241 -245
- nonebot_plugin_l4d2_server/message.py +58 -58
- nonebot_plugin_l4d2_server/seach.py +33 -33
- nonebot_plugin_l4d2_server/txt_to_img.py +64 -64
- nonebot_plugin_l4d2_server/utils.py +272 -272
- {nonebot_plugin_l4d2_server-0.5.1.dist-info → nonebot_plugin_l4d2_server-0.5.2.dist-info}/LICENSE +674 -674
- {nonebot_plugin_l4d2_server-0.5.1.dist-info → nonebot_plugin_l4d2_server-0.5.2.dist-info}/METADATA +6 -1
- nonebot_plugin_l4d2_server-0.5.2.dist-info/RECORD +54 -0
- {nonebot_plugin_l4d2_server-0.5.1.dist-info → nonebot_plugin_l4d2_server-0.5.2.dist-info}/WHEEL +1 -1
- nonebot_plugin_l4d2_server-0.5.1.dist-info/RECORD +0 -54
@@ -1,62 +1,62 @@
|
|
1
|
-
import asyncio
|
2
|
-
from rcon.source.proto import Packet,Type
|
3
|
-
from rcon.source.async_rcon import communicate,close
|
4
|
-
|
5
|
-
async def main(host):
|
6
|
-
host = '43.142.178.212'
|
7
|
-
port = 40003
|
8
|
-
password = '1145149191810'
|
9
|
-
encoding = 'utf-8'
|
10
|
-
|
11
|
-
# Connect to RCON server
|
12
|
-
|
13
|
-
|
14
|
-
# Main loop
|
15
|
-
while True:
|
16
|
-
# Read user input
|
17
|
-
command = input('> ')
|
18
|
-
if not command:
|
19
|
-
break
|
20
|
-
|
21
|
-
# 连接服务器
|
22
|
-
reader, writer = await asyncio.open_connection(host, port)
|
23
|
-
login = Packet.make_login(password, encoding=encoding)
|
24
|
-
response = await communicate(reader, writer, login)
|
25
|
-
|
26
|
-
# 等待 SERVERDATA_AUTH_RESPONSE 数据包
|
27
|
-
while response.type != Type.SERVERDATA_AUTH_RESPONSE:
|
28
|
-
response = await Packet.aread(reader)
|
29
|
-
|
30
|
-
if response.id == -1:
|
31
|
-
await close(writer)
|
32
|
-
raise WrongPassword()
|
33
|
-
|
34
|
-
# 循环接收用户输入并发送指令
|
35
|
-
while True:
|
36
|
-
try:
|
37
|
-
command = input('请输入指令:')
|
38
|
-
|
39
|
-
except EOFError:
|
40
|
-
break
|
41
|
-
|
42
|
-
if command=='停止':
|
43
|
-
break
|
44
|
-
# 发送指令
|
45
|
-
|
46
|
-
command = f'say {command}'
|
47
|
-
request = Packet.make_command(command, encoding=encoding)
|
48
|
-
response = await communicate(reader, writer, request)
|
49
|
-
|
50
|
-
# if response.id != request.id:
|
51
|
-
# raise SessionTimeout()
|
52
|
-
|
53
|
-
print(response.payload.decode(encoding, errors='ignore'))
|
54
|
-
|
55
|
-
# 断开连接
|
56
|
-
await close(writer)
|
57
|
-
|
58
|
-
class WrongPassword(Exception):
|
59
|
-
"""Indicates a wrong password."""
|
60
|
-
|
61
|
-
class SessionTimeout(Exception):
|
1
|
+
import asyncio
|
2
|
+
from rcon.source.proto import Packet,Type
|
3
|
+
from rcon.source.async_rcon import communicate,close
|
4
|
+
|
5
|
+
async def main(host):
|
6
|
+
host = '43.142.178.212'
|
7
|
+
port = 40003
|
8
|
+
password = '1145149191810'
|
9
|
+
encoding = 'utf-8'
|
10
|
+
|
11
|
+
# Connect to RCON server
|
12
|
+
|
13
|
+
|
14
|
+
# Main loop
|
15
|
+
while True:
|
16
|
+
# Read user input
|
17
|
+
command = input('> ')
|
18
|
+
if not command:
|
19
|
+
break
|
20
|
+
|
21
|
+
# 连接服务器
|
22
|
+
reader, writer = await asyncio.open_connection(host, port)
|
23
|
+
login = Packet.make_login(password, encoding=encoding)
|
24
|
+
response = await communicate(reader, writer, login)
|
25
|
+
|
26
|
+
# 等待 SERVERDATA_AUTH_RESPONSE 数据包
|
27
|
+
while response.type != Type.SERVERDATA_AUTH_RESPONSE:
|
28
|
+
response = await Packet.aread(reader)
|
29
|
+
|
30
|
+
if response.id == -1:
|
31
|
+
await close(writer)
|
32
|
+
raise WrongPassword()
|
33
|
+
|
34
|
+
# 循环接收用户输入并发送指令
|
35
|
+
while True:
|
36
|
+
try:
|
37
|
+
command = input('请输入指令:')
|
38
|
+
|
39
|
+
except EOFError:
|
40
|
+
break
|
41
|
+
|
42
|
+
if command=='停止':
|
43
|
+
break
|
44
|
+
# 发送指令
|
45
|
+
|
46
|
+
command = f'say {command}'
|
47
|
+
request = Packet.make_command(command, encoding=encoding)
|
48
|
+
response = await communicate(reader, writer, request)
|
49
|
+
|
50
|
+
# if response.id != request.id:
|
51
|
+
# raise SessionTimeout()
|
52
|
+
|
53
|
+
print(response.payload.decode(encoding, errors='ignore'))
|
54
|
+
|
55
|
+
# 断开连接
|
56
|
+
await close(writer)
|
57
|
+
|
58
|
+
class WrongPassword(Exception):
|
59
|
+
"""Indicates a wrong password."""
|
60
|
+
|
61
|
+
class SessionTimeout(Exception):
|
62
62
|
"""Indicates that the session timed out."""
|
@@ -1,29 +1,29 @@
|
|
1
|
-
from rcon.source import rcon
|
2
|
-
import asyncio
|
3
|
-
from pathlib import Path
|
4
|
-
from ..config import l4_config,CHECK_FILE
|
5
|
-
# from ..config import l4_rcon,l4_host,l4_port,l4_rcon
|
6
|
-
|
7
|
-
|
8
|
-
async def rcon_server(PASSWORD:str,msg:str):
|
9
|
-
# response = await rcon(command=msg, host=l4_host, port=l4_port, passwd=PASSWORD,encoding='utf-8')
|
10
|
-
# return response
|
11
|
-
try:
|
12
|
-
response = await asyncio.wait_for(rcon(command=msg, host=l4_config.l4_ipall[CHECK_FILE]['host'], port = l4_config.l4_ipall[CHECK_FILE]['port'], passwd=PASSWORD), timeout=30)
|
13
|
-
return response
|
14
|
-
except asyncio.TimeoutError:
|
15
|
-
return '超时'
|
16
|
-
|
17
|
-
async def read_server_cfg_rcon():
|
18
|
-
"""如果没有输入rcon,尝试自动获取"""
|
19
|
-
if not l4_config.l4_ipall[CHECK_FILE]['rcon']:
|
20
|
-
cfg_server = Path(l4_config.l4_ipall[CHECK_FILE]['location'],'left4dead2/cfg/server.cfg')
|
21
|
-
with open(cfg_server,'r')as cfg:
|
22
|
-
content:str = cfg.read()
|
23
|
-
lines = content.split('\n')
|
24
|
-
for line in lines:
|
25
|
-
if line.startswith('rcon_password'):
|
26
|
-
password = line.split(' ')[-1]
|
27
|
-
password = password.strip('"')
|
28
|
-
return password
|
1
|
+
from rcon.source import rcon
|
2
|
+
import asyncio
|
3
|
+
from pathlib import Path
|
4
|
+
from ..config import l4_config,CHECK_FILE
|
5
|
+
# from ..config import l4_rcon,l4_host,l4_port,l4_rcon
|
6
|
+
|
7
|
+
|
8
|
+
async def rcon_server(PASSWORD:str,msg:str):
|
9
|
+
# response = await rcon(command=msg, host=l4_host, port=l4_port, passwd=PASSWORD,encoding='utf-8')
|
10
|
+
# return response
|
11
|
+
try:
|
12
|
+
response = await asyncio.wait_for(rcon(command=msg, host=l4_config.l4_ipall[CHECK_FILE]['host'], port = l4_config.l4_ipall[CHECK_FILE]['port'], passwd=PASSWORD), timeout=30)
|
13
|
+
return response
|
14
|
+
except asyncio.TimeoutError:
|
15
|
+
return '超时'
|
16
|
+
|
17
|
+
async def read_server_cfg_rcon():
|
18
|
+
"""如果没有输入rcon,尝试自动获取"""
|
19
|
+
if not l4_config.l4_ipall[CHECK_FILE]['rcon']:
|
20
|
+
cfg_server = Path(l4_config.l4_ipall[CHECK_FILE]['location'],'left4dead2/cfg/server.cfg')
|
21
|
+
with open(cfg_server,'r')as cfg:
|
22
|
+
content:str = cfg.read()
|
23
|
+
lines = content.split('\n')
|
24
|
+
for line in lines:
|
25
|
+
if line.startswith('rcon_password'):
|
26
|
+
password = line.split(' ')[-1]
|
27
|
+
password = password.strip('"')
|
28
|
+
return password
|
29
29
|
return l4_config.l4_ipall[CHECK_FILE]['rcon']
|
@@ -1,50 +1,50 @@
|
|
1
|
-
import httpx
|
2
|
-
from nonebot.log import logger
|
3
|
-
try:
|
4
|
-
import ujson as json
|
5
|
-
except:
|
6
|
-
import json
|
7
|
-
|
8
|
-
async def workshop_to_dict(msg:str):
|
9
|
-
"""把创意工坊的id,转化为信息字典"""
|
10
|
-
i = await api_get_json(msg)
|
11
|
-
|
12
|
-
# 处理是否是多地图文件
|
13
|
-
if i['file_url'] == i['preview_url']:
|
14
|
-
return await primary_map(i)
|
15
|
-
else:
|
16
|
-
return await only_map(i)
|
17
|
-
|
18
|
-
|
19
|
-
async def api_get_json(msg:str) ->dict:
|
20
|
-
url_serach = 'https://db.steamworkshopdownloader.io/prod/api/details/file'
|
21
|
-
data = f'[{msg}]'
|
22
|
-
headers = {
|
23
|
-
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0'
|
24
|
-
}
|
25
|
-
data = httpx.post(url=url_serach,headers= headers,data=data).content.decode('utf-8')
|
26
|
-
logger.info(data)
|
27
|
-
out = {}
|
28
|
-
data = data[1:-1]
|
29
|
-
data = json.loads(data)
|
30
|
-
return data
|
31
|
-
|
32
|
-
|
33
|
-
async def only_map(i:dict):
|
34
|
-
"""单地图下载"""
|
35
|
-
out = {}
|
36
|
-
out['名字'] = i['title']
|
37
|
-
out['游戏'] = i['app_name']
|
38
|
-
out['下载地址'] = i['file_url']
|
39
|
-
out['图片地址'] = i['preview_url']
|
40
|
-
out['细节'] = i['file_description']
|
41
|
-
return out
|
42
|
-
|
43
|
-
async def primary_map(i):
|
44
|
-
"""主地图返回多地图参数"""
|
45
|
-
map_list = []
|
46
|
-
map_list.append(i)
|
47
|
-
for one in i['children']:
|
48
|
-
map_list.append(await api_get_json(one['publishedfileid']))
|
49
|
-
return map_list
|
50
|
-
|
1
|
+
import httpx
|
2
|
+
from nonebot.log import logger
|
3
|
+
try:
|
4
|
+
import ujson as json
|
5
|
+
except:
|
6
|
+
import json
|
7
|
+
|
8
|
+
async def workshop_to_dict(msg:str):
|
9
|
+
"""把创意工坊的id,转化为信息字典"""
|
10
|
+
i = await api_get_json(msg)
|
11
|
+
|
12
|
+
# 处理是否是多地图文件
|
13
|
+
if i['file_url'] == i['preview_url']:
|
14
|
+
return await primary_map(i)
|
15
|
+
else:
|
16
|
+
return await only_map(i)
|
17
|
+
|
18
|
+
|
19
|
+
async def api_get_json(msg:str) ->dict:
|
20
|
+
url_serach = 'https://db.steamworkshopdownloader.io/prod/api/details/file'
|
21
|
+
data = f'[{msg}]'
|
22
|
+
headers = {
|
23
|
+
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0'
|
24
|
+
}
|
25
|
+
data = httpx.post(url=url_serach,headers= headers,data=data).content.decode('utf-8')
|
26
|
+
logger.info(data)
|
27
|
+
out = {}
|
28
|
+
data = data[1:-1]
|
29
|
+
data = json.loads(data)
|
30
|
+
return data
|
31
|
+
|
32
|
+
|
33
|
+
async def only_map(i:dict):
|
34
|
+
"""单地图下载"""
|
35
|
+
out = {}
|
36
|
+
out['名字'] = i['title']
|
37
|
+
out['游戏'] = i['app_name']
|
38
|
+
out['下载地址'] = i['file_url']
|
39
|
+
out['图片地址'] = i['preview_url']
|
40
|
+
out['细节'] = i['file_description']
|
41
|
+
return out
|
42
|
+
|
43
|
+
async def primary_map(i):
|
44
|
+
"""主地图返回多地图参数"""
|
45
|
+
map_list = []
|
46
|
+
map_list.append(i)
|
47
|
+
for one in i['children']:
|
48
|
+
map_list.append(await api_get_json(one['publishedfileid']))
|
49
|
+
return map_list
|
50
|
+
|