nonebot-plugin-l4d2-server 1.0.0a1__py3-none-any.whl → 1.0.0b1__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 +4 -4
- nonebot_plugin_l4d2_server/__main__.py +65 -14
- nonebot_plugin_l4d2_server/config.py +11 -0
- nonebot_plugin_l4d2_server/l4_anne/__init__.py +125 -0
- nonebot_plugin_l4d2_server/l4_anne/ranne.py +18 -0
- nonebot_plugin_l4d2_server/l4_help/Help.json +67 -22
- nonebot_plugin_l4d2_server/l4_help/__init__.py +2 -2
- nonebot_plugin_l4d2_server/l4_help/icon//344/273/213/347/273/215.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//344/273/273/345/212/241.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//344/277/241/346/201/257.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/205/254/345/221/212.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/210/200/345/211/221.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/210/207/346/215/242.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/210/240/351/231/244.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/210/267/346/226/260.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/215/241/347/273/204.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/223/252/351/207/214.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/234/260/345/233/276.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/257/274/345/205/245.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/257/274/345/207/272.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/275/261.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/213/274/345/233/276.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/216/242/347/264/242.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/216/250/351/200/201.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/224/266/351/233/206.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/224/273/347/225/245.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/233/264/346/226/260.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/235/220/346/226/231.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/237/245/350/257/242.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/240/241/351/252/214.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/257/217/346/234/210.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/267/261/346/270/212.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/267/273/345/212/240.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/270/205/351/231/244.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//347/212/266/346/200/201.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//347/255/276/345/210/260.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//347/273/221/345/256/232.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//350/241/250.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//350/241/250/346/203/205.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//350/247/222/350/211/262.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//350/256/260/345/275/225.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//351/205/215/347/275/256.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//351/207/215/345/220/257.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/texture2d/badge.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/texture2d/banner.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/texture2d/bg.jpg +0 -0
- nonebot_plugin_l4d2_server/l4_help/texture2d/button.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/texture2d/icon.png +0 -0
- nonebot_plugin_l4d2_server/l4_image/__init__.py +4 -4
- nonebot_plugin_l4d2_server/l4_image/anne_pil.py +18 -0
- nonebot_plugin_l4d2_server/l4_image/convert.py +9 -13
- nonebot_plugin_l4d2_server/l4_image/download.py +9 -7
- nonebot_plugin_l4d2_server/l4_image/html_img.py +47 -76
- nonebot_plugin_l4d2_server/l4_image/image_tools.py +19 -16
- nonebot_plugin_l4d2_server/l4_image/img/anne/back.png +0 -0
- nonebot_plugin_l4d2_server/l4_image/img/anne/back1.jpg +0 -0
- nonebot_plugin_l4d2_server/l4_image/img/head/head.png +0 -0
- nonebot_plugin_l4d2_server/l4_image/img/header/logo.png +0 -0
- nonebot_plugin_l4d2_server/l4_image/img/header/player1.jpg +0 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/Bocchi_The_Rock.html +17 -30
- nonebot_plugin_l4d2_server/l4_image/img/template/Bocchi_The_Rock.png +0 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/Pixel.html +17 -26
- nonebot_plugin_l4d2_server/l4_image/img/template/Pixel.png +0 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/Rainbow.html +48 -14
- nonebot_plugin_l4d2_server/l4_image/img/template/Rainbow.png +0 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/normal.html +14 -24
- nonebot_plugin_l4d2_server/{data/img → l4_image/img/template}/vac.png +0 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/vac_white.png +0 -0
- nonebot_plugin_l4d2_server/l4_image/vtfs.py +3 -3
- nonebot_plugin_l4d2_server/l4_local/__init__.py +94 -0
- nonebot_plugin_l4d2_server/l4_local/file.py +105 -0
- nonebot_plugin_l4d2_server/l4_request/__init__.py +68 -9
- nonebot_plugin_l4d2_server/l4_request/draw_msg.py +38 -43
- nonebot_plugin_l4d2_server/l4_request/utils.py +0 -0
- nonebot_plugin_l4d2_server/utils/api/api.py +8 -2
- nonebot_plugin_l4d2_server/utils/api/models.py +108 -0
- nonebot_plugin_l4d2_server/utils/api/request.py +257 -39
- nonebot_plugin_l4d2_server/utils/database/models.py +12 -23
- nonebot_plugin_l4d2_server/utils/utils.py +22 -11
- {nonebot_plugin_l4d2_server-1.0.0a1.dist-info → nonebot_plugin_l4d2_server-1.0.0b1.dist-info}/METADATA +19 -11
- nonebot_plugin_l4d2_server-1.0.0b1.dist-info/RECORD +98 -0
- nonebot_plugin_l4d2_server/data/L4D2/image/head/head.png +0 -0
- nonebot_plugin_l4d2_server/data/L4D2/image/header/logo.png +0 -0
- nonebot_plugin_l4d2_server/data/L4D2/image/header/player1.jpg +0 -0
- nonebot_plugin_l4d2_server/data/L4D2/image/template/anne.html +0 -68
- nonebot_plugin_l4d2_server/data/L4D2/image/template/back.png +0 -0
- nonebot_plugin_l4d2_server/data/L4D2/image/template/fingerprint.svg +0 -15
- nonebot_plugin_l4d2_server/data/L4D2/image/template/group_ip.html +0 -258
- nonebot_plugin_l4d2_server/data/L4D2/image/template/help.html +0 -262
- nonebot_plugin_l4d2_server/data/L4D2/image/template/help_dack.html +0 -269
- nonebot_plugin_l4d2_server/data/L4D2/image/template/ip.html +0 -54
- nonebot_plugin_l4d2_server/data/L4D2/image/template/l.svg +0 -10
- nonebot_plugin_l4d2_server/data/L4D2/image/template/m.svg +0 -1
- nonebot_plugin_l4d2_server/data/L4D2/image/template/vue.css +0 -531
- nonebot_plugin_l4d2_server/data/L4D2/image/template/w.svg +0 -1
- nonebot_plugin_l4d2_server/data/icon//344/273/213/347/273/215.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//344/273/273/345/212/241.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//344/277/241/346/201/257.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/205/254/345/221/212.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/210/200/345/211/221.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/210/207/346/215/242.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/210/240/351/231/244.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/210/267/346/226/260.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/215/241/347/273/204.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/223/252/351/207/214.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/234/260/345/233/276.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/257/274/345/205/245.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/257/274/345/207/272.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/275/261.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/213/274/345/233/276.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/216/242/347/264/242.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/216/250/351/200/201.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/224/266/351/233/206.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/224/273/347/225/245.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/233/264/346/226/260.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/235/220/346/226/231.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/237/245/350/257/242.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/240/241/351/252/214.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/257/217/346/234/210.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/267/261/346/270/212.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/267/273/345/212/240.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/270/205/351/231/244.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//347/212/266/346/200/201.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//347/255/276/345/210/260.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//347/273/221/345/256/232.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//350/241/250.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//350/241/250/346/203/205.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//350/247/222/350/211/262.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//350/256/260/345/275/225.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//351/205/215/347/275/256.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//351/207/215/345/220/257.png +0 -0
- nonebot_plugin_l4d2_server/data/img/l4d2.png +0 -0
- nonebot_plugin_l4d2_server/data/img/linux.png +0 -0
- nonebot_plugin_l4d2_server/data/img/white.png +0 -0
- nonebot_plugin_l4d2_server/l4_image/img/template//345/276/256/350/275/257/351/233/205/351/273/221.ttf +0 -0
- nonebot_plugin_l4d2_server-1.0.0a1.dist-info/RECORD +0 -144
- {nonebot_plugin_l4d2_server-1.0.0a1.dist-info → nonebot_plugin_l4d2_server-1.0.0b1.dist-info}/WHEEL +0 -0
- {nonebot_plugin_l4d2_server-1.0.0a1.dist-info → nonebot_plugin_l4d2_server-1.0.0b1.dist-info}/licenses/LICENSE +0 -0
@@ -17,15 +17,15 @@
|
|
17
17
|
|
18
18
|
from nonebot import get_driver, require
|
19
19
|
|
20
|
-
require("nonebot_plugin_htmlrender")
|
20
|
+
require("nonebot_plugin_htmlrender")
|
21
21
|
require("nonebot_plugin_alconna")
|
22
|
+
require("nonebot_plugin_tortoise_orm")
|
22
23
|
|
23
|
-
from nonebot import
|
24
|
-
from nonebot.plugin import PluginMetadata, inherit_supported_adapters
|
24
|
+
from nonebot.plugin import PluginMetadata, inherit_supported_adapters # noqa: E402
|
25
25
|
|
26
26
|
from . import __main__ as __main__ # noqa: E402
|
27
27
|
from .config import ConfigModel # noqa: E402
|
28
|
-
from .l4_help import __version__
|
28
|
+
from .l4_help import __version__ # noqa: E402
|
29
29
|
|
30
30
|
driver = get_driver()
|
31
31
|
|
@@ -15,25 +15,38 @@
|
|
15
15
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
16
16
|
"""
|
17
17
|
|
18
|
-
from typing import Optional
|
18
|
+
from typing import TYPE_CHECKING, List, Optional
|
19
19
|
|
20
|
-
from nonebot import require
|
21
20
|
from nonebot.adapters import Message
|
22
21
|
from nonebot.log import logger
|
23
22
|
from nonebot.matcher import Matcher
|
24
23
|
from nonebot.params import CommandArg, CommandStart, RawCommand
|
25
24
|
from nonebot.plugin import on_command
|
26
|
-
|
27
|
-
require("nonebot_plugin_alconna")
|
28
25
|
from nonebot_plugin_alconna import UniMessage
|
29
26
|
|
27
|
+
from .config import config
|
30
28
|
from .l4_help import get_l4d2_core_help
|
31
|
-
from .
|
29
|
+
from .l4_local import * # noqa: F403
|
30
|
+
from .l4_request import (
|
31
|
+
COMMAND,
|
32
|
+
get_all_server_detail,
|
33
|
+
get_ip_server,
|
34
|
+
get_server_detail,
|
35
|
+
reload_ip,
|
36
|
+
)
|
37
|
+
from .utils.api.request import L4API
|
38
|
+
|
39
|
+
if TYPE_CHECKING:
|
40
|
+
from .utils.api.models import OutServer
|
41
|
+
|
42
|
+
reload_ip()
|
32
43
|
|
33
|
-
l4_help = on_command("
|
34
|
-
l4_request = on_command("anne", aliases=COMMAND)
|
35
|
-
l4_reload = on_command("
|
44
|
+
l4_help = on_command("l4help", aliases={"l4帮助", "l4d2帮助"})
|
45
|
+
l4_request = on_command("anne", aliases=COMMAND, priority=10)
|
46
|
+
l4_reload = on_command("l4reload", aliases={"l4刷新,l4重载"})
|
47
|
+
l4_all = on_command("l4all", aliases={"l4全服"})
|
36
48
|
l4_connect = on_command("connect", aliases={"l4连接"})
|
49
|
+
l4_find_player = on_command("l4find", aliases={"l4查找"})
|
37
50
|
|
38
51
|
|
39
52
|
@l4_help.handle()
|
@@ -41,7 +54,6 @@ async def _(matcher: Matcher):
|
|
41
54
|
"""帮助"""
|
42
55
|
logger.info("开始执行[l4d2帮助]")
|
43
56
|
im = await get_l4d2_core_help()
|
44
|
-
print(type(im))
|
45
57
|
if isinstance(im, str):
|
46
58
|
await matcher.finish(im)
|
47
59
|
await UniMessage.image(raw=im).send()
|
@@ -65,6 +77,8 @@ async def _(
|
|
65
77
|
if command == "anne":
|
66
78
|
command = "云"
|
67
79
|
_id: Optional[str] = args.extract_plain_text()
|
80
|
+
if _id is not None and not _id.isdigit() and _id:
|
81
|
+
return
|
68
82
|
if not _id:
|
69
83
|
_id = None
|
70
84
|
logger.info(f"组:{command} ;数字:{_id}")
|
@@ -72,9 +86,34 @@ async def _(
|
|
72
86
|
if msg is not None:
|
73
87
|
if isinstance(msg, str):
|
74
88
|
await UniMessage.text(msg).finish()
|
75
|
-
|
89
|
+
if isinstance(msg, bytes):
|
90
|
+
await UniMessage.image(raw=msg).finish()
|
76
91
|
else:
|
77
|
-
await UniMessage.text("
|
92
|
+
await UniMessage.text("服务器无响应").finish()
|
93
|
+
|
94
|
+
|
95
|
+
@l4_find_player.handle()
|
96
|
+
async def _(
|
97
|
+
args: Message = CommandArg(),
|
98
|
+
):
|
99
|
+
msg: str = args.extract_plain_text().strip()
|
100
|
+
tag_list: List[str] = msg.split(" ", maxsplit=1)
|
101
|
+
if len(tag_list) < 2:
|
102
|
+
return await UniMessage.text("格式错误,正确格式:/l4find 组名 玩家名").finish()
|
103
|
+
group, name = tag_list
|
104
|
+
out: List[OutServer] = await get_server_detail(group, is_img=False) # type: ignore
|
105
|
+
out_msg = "未找到玩家"
|
106
|
+
for one in out:
|
107
|
+
for player in one["player"]:
|
108
|
+
if name in player.name:
|
109
|
+
out_msg = await get_ip_server(f"{one['host']}:{one['port']}")
|
110
|
+
|
111
|
+
return await UniMessage.text(out_msg).finish()
|
112
|
+
|
113
|
+
|
114
|
+
@l4_all.handle()
|
115
|
+
async def _():
|
116
|
+
await UniMessage.text(await get_all_server_detail()).finish()
|
78
117
|
|
79
118
|
|
80
119
|
@l4_connect.handle()
|
@@ -84,7 +123,19 @@ async def _(args: Message = CommandArg()):
|
|
84
123
|
await UniMessage.text(await get_ip_server(ip)).finish()
|
85
124
|
|
86
125
|
|
126
|
+
# anne部分
|
127
|
+
if config.l4_anne:
|
128
|
+
logger.info("加载anne功能")
|
129
|
+
from .l4_anne import * # noqa: F403
|
130
|
+
|
131
|
+
|
87
132
|
@l4_reload.handle()
|
88
|
-
async def _():
|
89
|
-
|
90
|
-
|
133
|
+
async def _(args: Message = CommandArg()):
|
134
|
+
arg = args.extract_plain_text().strip()
|
135
|
+
print(arg)
|
136
|
+
if not arg:
|
137
|
+
reload_ip()
|
138
|
+
logger.success("重载ip完成")
|
139
|
+
await UniMessage.text("重载ip完成").finish()
|
140
|
+
else:
|
141
|
+
print(await L4API.get_sourceban())
|
@@ -5,11 +5,15 @@ from pydantic import BaseModel
|
|
5
5
|
|
6
6
|
DATAPATH = Path(__file__).parent.joinpath("data")
|
7
7
|
DATAOUT = Path("data/L4D2")
|
8
|
+
print(DATAOUT.absolute())
|
8
9
|
server_all_path = DATAOUT / "l4d2"
|
9
10
|
server_all_path.mkdir(parents=True, exist_ok=True)
|
10
11
|
|
11
12
|
ICONPATH = DATAPATH / "icon"
|
12
13
|
|
14
|
+
global map_index
|
15
|
+
map_index = 0
|
16
|
+
|
13
17
|
|
14
18
|
class ConfigModel(BaseModel):
|
15
19
|
l4_anne: bool = False
|
@@ -25,6 +29,13 @@ class ConfigModel(BaseModel):
|
|
25
29
|
l4_players: int = 4
|
26
30
|
"""查询总图的时候展示的用户数量"""
|
27
31
|
l4_style: str = "default"
|
32
|
+
"""图片风格"""
|
33
|
+
l4_font: str = str(Path(__file__).parent.joinpath("data/font/loli.ttf"))
|
34
|
+
"""字体"""
|
35
|
+
l4_show_ip: bool = True
|
36
|
+
"""单服务器查询时候是否展示ip直连地址"""
|
37
|
+
l4_local: list[str] = []
|
38
|
+
"""本地服务器路径,填写路径下有`steam_appid.txt`文件"""
|
28
39
|
|
29
40
|
|
30
41
|
config = get_plugin_config(ConfigModel)
|
@@ -0,0 +1,125 @@
|
|
1
|
+
from nonebot import log as log
|
2
|
+
from nonebot import on_command
|
3
|
+
from nonebot.adapters import Event, Message
|
4
|
+
from nonebot.log import logger
|
5
|
+
from nonebot.params import CommandArg
|
6
|
+
from nonebot_plugin_alconna import UniMessage
|
7
|
+
|
8
|
+
from ..utils.api.request import L4API
|
9
|
+
from ..utils.database.models import SteamUser
|
10
|
+
from ..utils.utils import get_message_at
|
11
|
+
from .ranne import get_anne_rank_out
|
12
|
+
|
13
|
+
anne_bind = on_command("Banne", aliases={"l4绑定", "anne绑定"}, priority=5, block=True)
|
14
|
+
anne_search = on_command("Sanne", aliases={"anne搜索"})
|
15
|
+
anne_rank = on_command("Ranne", aliases={"anne成绩"}, block=True, priority=1)
|
16
|
+
|
17
|
+
anne_del = on_command(
|
18
|
+
"Danne",
|
19
|
+
aliases={"l4删除", "anne删除", "l4解绑", "anne解绑"},
|
20
|
+
priority=5,
|
21
|
+
block=True,
|
22
|
+
)
|
23
|
+
|
24
|
+
|
25
|
+
@anne_search.handle()
|
26
|
+
async def _(args: Message = CommandArg()):
|
27
|
+
name: str = args.extract_plain_text().strip()
|
28
|
+
print(name)
|
29
|
+
user_list = await L4API.get_anne_steamid(name)
|
30
|
+
if user_list is None:
|
31
|
+
await UniMessage.text("未找到玩家").finish()
|
32
|
+
msg = f"---有{len(user_list)}个玩家---"
|
33
|
+
for index, user in enumerate(user_list, start=1):
|
34
|
+
if index >= 10:
|
35
|
+
break
|
36
|
+
msg += f"""
|
37
|
+
{index}. {user["name"]} | [{user["score"]}] | {user["play_time"]}
|
38
|
+
{user["steamid"]}
|
39
|
+
"""
|
40
|
+
if msg:
|
41
|
+
await UniMessage.text("\n".join(msg.splitlines())).finish()
|
42
|
+
else:
|
43
|
+
await UniMessage.text("没有找到玩家").finish()
|
44
|
+
|
45
|
+
|
46
|
+
@anne_bind.handle()
|
47
|
+
async def _(ev: Event, args: Message = CommandArg()):
|
48
|
+
arg: str = args.extract_plain_text()
|
49
|
+
if not arg:
|
50
|
+
await UniMessage.text("虚空绑定?").finish()
|
51
|
+
|
52
|
+
user = await SteamUser.get_or_none(userid=int(ev.get_user_id()))
|
53
|
+
if user is None:
|
54
|
+
user = await SteamUser.create(userid=int(ev.get_user_id()))
|
55
|
+
|
56
|
+
if len(arg) == 17:
|
57
|
+
# steamid64
|
58
|
+
logger.info(f"SteamID64:{arg}")
|
59
|
+
user.SteamID64 = arg
|
60
|
+
msg = "绑定steamid64"
|
61
|
+
|
62
|
+
elif arg.startswith("STEAM_"):
|
63
|
+
# steamid
|
64
|
+
logger.info(f"SteamID:{arg}")
|
65
|
+
user.SteamID = arg
|
66
|
+
msg = "绑定steamid"
|
67
|
+
|
68
|
+
else:
|
69
|
+
# name
|
70
|
+
logger.info(f"Name:{arg}")
|
71
|
+
user.Name = arg
|
72
|
+
msg = "绑定名字"
|
73
|
+
await user.save()
|
74
|
+
|
75
|
+
return await UniMessage.text(f"{msg}成功").finish()
|
76
|
+
|
77
|
+
|
78
|
+
@anne_del.handle()
|
79
|
+
async def _(ev: Event):
|
80
|
+
if record := await SteamUser.get_or_none(userid=int(ev.get_user_id())):
|
81
|
+
logger.info(f"删除用户:{record}")
|
82
|
+
await record.delete()
|
83
|
+
await record.save()
|
84
|
+
return await UniMessage.text("删除成功").finish()
|
85
|
+
return await UniMessage.text("没有绑定信息呢").finish()
|
86
|
+
|
87
|
+
|
88
|
+
@anne_rank.handle()
|
89
|
+
async def _(ev: Event, args: Message = CommandArg()):
|
90
|
+
uid = await get_message_at(str(ev.json()))
|
91
|
+
if uid is None:
|
92
|
+
uid = int(int(ev.get_user_id()))
|
93
|
+
steamid = ""
|
94
|
+
arg: str = args.extract_plain_text().strip()
|
95
|
+
logger.info(f"arg:{arg}")
|
96
|
+
# 优先从数据库查询
|
97
|
+
if not arg:
|
98
|
+
msg = await SteamUser.get_or_none(userid=uid)
|
99
|
+
if msg is not None:
|
100
|
+
steamid = msg.SteamID
|
101
|
+
if not steamid:
|
102
|
+
name = msg.Name
|
103
|
+
if not name:
|
104
|
+
await UniMessage.text("未绑定名字/steamid").finish()
|
105
|
+
msg_dict = await L4API.get_anne_steamid(name)
|
106
|
+
if not msg_dict:
|
107
|
+
await UniMessage.text("绑定的昵称找不到呢").finish()
|
108
|
+
steamid = msg_dict[0]["steamid"]
|
109
|
+
logger.info(f"steamid:{steamid}")
|
110
|
+
|
111
|
+
# 再从arg中查找
|
112
|
+
else:
|
113
|
+
if arg.startswith("STEAM_"):
|
114
|
+
steamid = arg
|
115
|
+
else:
|
116
|
+
arg_dict = await L4API.get_anne_steamid(arg)
|
117
|
+
if not arg_dict:
|
118
|
+
await UniMessage.text("未找到该昵称玩家").finish()
|
119
|
+
steamid = arg_dict[0]["steamid"]
|
120
|
+
if not steamid:
|
121
|
+
await UniMessage.text("未找到玩家,请使用指令`l4搜索`查找").finish()
|
122
|
+
out_msg = await get_anne_rank_out(steamid)
|
123
|
+
if out_msg is None:
|
124
|
+
await UniMessage.text("未找到玩家").finish()
|
125
|
+
await UniMessage.text(out_msg).finish()
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# coding=utf-8
|
2
|
+
# anne战绩查询
|
3
|
+
from ..utils.api.request import L4API
|
4
|
+
|
5
|
+
|
6
|
+
async def get_anne_rank_out(steamid: str):
|
7
|
+
msg = await L4API.get_anne_playerdetail(steamid)
|
8
|
+
if msg is None:
|
9
|
+
return None
|
10
|
+
return f"""电信anne查询结果:
|
11
|
+
昵称:{msg['info']['name']}
|
12
|
+
排名:{msg['detail']['rank']}
|
13
|
+
分数:{msg['detail']["source"]}
|
14
|
+
击杀:{msg['detail']["kills"]}
|
15
|
+
爆头率:{msg['detail']["avg_source"]}
|
16
|
+
时间:{msg['info']['playtime']}
|
17
|
+
上次:{msg['info']['lasttime']}
|
18
|
+
"""
|
@@ -3,49 +3,94 @@
|
|
3
3
|
"desc": "无需任何权限",
|
4
4
|
"data": [
|
5
5
|
{
|
6
|
-
"name": "
|
7
|
-
"desc": "
|
8
|
-
"eg": "
|
6
|
+
"name": "(组)",
|
7
|
+
"desc": "返回一个组的服务器信息",
|
8
|
+
"eg": "/云",
|
9
9
|
"need_ck": false,
|
10
10
|
"need_sk": false,
|
11
11
|
"need_admin": false
|
12
12
|
},
|
13
13
|
{
|
14
|
-
"name": "(
|
15
|
-
"desc": "
|
16
|
-
"eg": "
|
14
|
+
"name": "(组)(id)",
|
15
|
+
"desc": "查询单服信息",
|
16
|
+
"eg": "/云1",
|
17
|
+
"need_ck": false,
|
18
|
+
"need_sk": false,
|
19
|
+
"need_admin": false
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"name": "l4查找(组)(玩家)",
|
23
|
+
"desc": "查询用户所在服务器状态",
|
24
|
+
"eg": "/l4查找 云 爱丽数码",
|
17
25
|
"need_ck": false,
|
18
26
|
"need_sk": false,
|
19
27
|
"need_admin": false
|
20
28
|
},
|
21
29
|
{
|
22
|
-
"name": "
|
23
|
-
"desc": "
|
24
|
-
"eg": "
|
30
|
+
"name": "l4全服",
|
31
|
+
"desc": "返回可以查询的所有服务器组(未完成)",
|
32
|
+
"eg": "/l4全服",
|
25
33
|
"need_ck": false,
|
26
34
|
"need_sk": false,
|
27
35
|
"need_admin": false
|
28
36
|
}
|
29
37
|
]
|
30
38
|
},
|
31
|
-
"
|
32
|
-
"desc": "
|
39
|
+
"电信服anne服务": {
|
40
|
+
"desc": "电信anne服相关服务",
|
33
41
|
"data": [
|
34
42
|
{
|
35
|
-
"name": "
|
36
|
-
"desc": "
|
37
|
-
"eg": "
|
38
|
-
"need_ck":
|
43
|
+
"name": "Banne xx",
|
44
|
+
"desc": "绑定昵称/steamid",
|
45
|
+
"eg": "/Banne 爱丽数码",
|
46
|
+
"need_ck": false,
|
47
|
+
"need_sk": false,
|
48
|
+
"need_admin": false
|
49
|
+
},
|
50
|
+
{
|
51
|
+
"name": "Ranne(玩家)",
|
52
|
+
"desc": "查询anne个人信息,没有参数查自己",
|
53
|
+
"eg": "/Ranne 爱丽数码",
|
54
|
+
"need_ck": false,
|
39
55
|
"need_sk": false,
|
40
56
|
"need_admin": false
|
41
57
|
},
|
42
58
|
{
|
43
|
-
"name": "
|
44
|
-
"desc": "
|
45
|
-
"eg": "
|
46
|
-
"need_ck":
|
59
|
+
"name": "Sanne(玩家)",
|
60
|
+
"desc": "按昵称查询anne玩家信息",
|
61
|
+
"eg": "/Sanne 爱丽数码",
|
62
|
+
"need_ck": false,
|
47
63
|
"need_sk": false,
|
48
64
|
"need_admin": false
|
65
|
+
},
|
66
|
+
{
|
67
|
+
"name": "Danne(玩家)",
|
68
|
+
"desc": "删除anne玩家信息",
|
69
|
+
"eg": "/Danne 爱丽数码",
|
70
|
+
"need_ck": false,
|
71
|
+
"need_sk": false,
|
72
|
+
"need_admin": false
|
73
|
+
}
|
74
|
+
]
|
75
|
+
},
|
76
|
+
"管理员服务": {
|
77
|
+
"desc": "管理可以使用的指令",
|
78
|
+
"data": [
|
79
|
+
{
|
80
|
+
"name": "l4刷新",
|
81
|
+
"desc": "重载存储的ip数据",
|
82
|
+
"eg": "l4刷新",
|
83
|
+
"need_ck": false,
|
84
|
+
"need_sk": false,
|
85
|
+
"need_admin": true
|
86
|
+
},
|
87
|
+
{
|
88
|
+
"name": "l4地图上传",
|
89
|
+
"desc": "进入交互上传地图文件",
|
90
|
+
"eg": "l4地图上传",
|
91
|
+
"need_ck": false,
|
92
|
+
"need_sk": false,
|
93
|
+
"need_admin": true
|
49
94
|
}
|
50
95
|
]
|
51
96
|
},
|
@@ -53,9 +98,9 @@
|
|
53
98
|
"desc": "一些杂项服务",
|
54
99
|
"data": [
|
55
100
|
{
|
56
|
-
"name": "
|
57
|
-
"desc": "
|
58
|
-
"eg": "
|
101
|
+
"name": "connect",
|
102
|
+
"desc": "直接发送求生链接返回信息",
|
103
|
+
"eg": "connect 127.0.0.1:27015",
|
59
104
|
"need_ck": false,
|
60
105
|
"need_sk": false,
|
61
106
|
"need_admin": false
|
@@ -10,7 +10,7 @@ from ..l4_image.convert import core_font
|
|
10
10
|
from ..l4_image.model import PluginHelp
|
11
11
|
from .draw import get_help
|
12
12
|
|
13
|
-
__version__ = "1.0.
|
13
|
+
__version__ = "1.0.0b1"
|
14
14
|
TEXT_PATH = Path(__file__).parent / "texture2d"
|
15
15
|
HELP_DATA = Path(__file__).parent / "Help.json"
|
16
16
|
|
@@ -39,7 +39,7 @@ async def get_l4d2_core_help() -> Union[bytes, str]:
|
|
39
39
|
bg_out.paste(bg_new, None, bg_new)
|
40
40
|
|
41
41
|
return await get_help(
|
42
|
-
"
|
42
|
+
"L4插件",
|
43
43
|
f"版本号:{__version__}",
|
44
44
|
help_data,
|
45
45
|
bg_out,
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,15 +1,15 @@
|
|
1
|
-
from typing import List
|
1
|
+
from typing import List # noqa:
|
2
2
|
|
3
3
|
from ..utils.api.models import OutServer
|
4
4
|
from .html_img import server_ip_pic
|
5
5
|
|
6
6
|
|
7
|
-
async def msg_to_image(server_dict: List[OutServer],
|
7
|
+
async def msg_to_image(server_dict: List[OutServer], mode_: str = "html"):
|
8
8
|
"""信息构造图片"""
|
9
|
-
if
|
9
|
+
if mode_ == "html":
|
10
10
|
"""用浏览器作图"""
|
11
11
|
return await server_ip_pic(server_dict)
|
12
|
-
if
|
12
|
+
if mode_ == "pil":
|
13
13
|
"""用pil作图"""
|
14
14
|
return None
|
15
15
|
"""返回文字"""
|
@@ -0,0 +1,18 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
|
3
|
+
from PIL import Image, ImageFont
|
4
|
+
|
5
|
+
from nonebot_plugin_l4d2_server.utils.api.models import AnnePlayer2
|
6
|
+
|
7
|
+
from ..config import config
|
8
|
+
|
9
|
+
font = ImageFont.truetype(config.l4_font)
|
10
|
+
|
11
|
+
anne_path = Path(__file__).parent / "img" / "anne"
|
12
|
+
|
13
|
+
|
14
|
+
async def anne_player_info(msg: AnnePlayer2): # noqa: RUF029
|
15
|
+
back_img = Image.open(anne_path / "back1.jpg")
|
16
|
+
base_img = Image.new("RGBA", (back_img.size), (255, 255, 255, 50))
|
17
|
+
back_img.paste(base_img, (0, 0), base_img)
|
18
|
+
return msg
|