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.
Files changed (138) hide show
  1. nonebot_plugin_l4d2_server/__init__.py +4 -4
  2. nonebot_plugin_l4d2_server/__main__.py +65 -14
  3. nonebot_plugin_l4d2_server/config.py +11 -0
  4. nonebot_plugin_l4d2_server/l4_anne/__init__.py +125 -0
  5. nonebot_plugin_l4d2_server/l4_anne/ranne.py +18 -0
  6. nonebot_plugin_l4d2_server/l4_help/Help.json +67 -22
  7. nonebot_plugin_l4d2_server/l4_help/__init__.py +2 -2
  8. nonebot_plugin_l4d2_server/l4_help/icon//344/273/213/347/273/215.png +0 -0
  9. nonebot_plugin_l4d2_server/l4_help/icon//344/273/273/345/212/241.png +0 -0
  10. nonebot_plugin_l4d2_server/l4_help/icon//344/277/241/346/201/257.png +0 -0
  11. nonebot_plugin_l4d2_server/l4_help/icon//345/205/254/345/221/212.png +0 -0
  12. nonebot_plugin_l4d2_server/l4_help/icon//345/210/200/345/211/221.png +0 -0
  13. nonebot_plugin_l4d2_server/l4_help/icon//345/210/207/346/215/242.png +0 -0
  14. nonebot_plugin_l4d2_server/l4_help/icon//345/210/240/351/231/244.png +0 -0
  15. nonebot_plugin_l4d2_server/l4_help/icon//345/210/267/346/226/260.png +0 -0
  16. nonebot_plugin_l4d2_server/l4_help/icon//345/215/241/347/273/204.png +0 -0
  17. nonebot_plugin_l4d2_server/l4_help/icon//345/223/252/351/207/214.png +0 -0
  18. nonebot_plugin_l4d2_server/l4_help/icon//345/234/260/345/233/276.png +0 -0
  19. nonebot_plugin_l4d2_server/l4_help/icon//345/257/274/345/205/245.png +0 -0
  20. nonebot_plugin_l4d2_server/l4_help/icon//345/257/274/345/207/272.png +0 -0
  21. nonebot_plugin_l4d2_server/l4_help/icon//345/275/261.png +0 -0
  22. nonebot_plugin_l4d2_server/l4_help/icon//346/213/274/345/233/276.png +0 -0
  23. nonebot_plugin_l4d2_server/l4_help/icon//346/216/242/347/264/242.png +0 -0
  24. nonebot_plugin_l4d2_server/l4_help/icon//346/216/250/351/200/201.png +0 -0
  25. nonebot_plugin_l4d2_server/l4_help/icon//346/224/266/351/233/206.png +0 -0
  26. nonebot_plugin_l4d2_server/l4_help/icon//346/224/273/347/225/245.png +0 -0
  27. nonebot_plugin_l4d2_server/l4_help/icon//346/233/264/346/226/260.png +0 -0
  28. nonebot_plugin_l4d2_server/l4_help/icon//346/235/220/346/226/231.png +0 -0
  29. nonebot_plugin_l4d2_server/l4_help/icon//346/237/245/350/257/242.png +0 -0
  30. nonebot_plugin_l4d2_server/l4_help/icon//346/240/241/351/252/214.png +0 -0
  31. nonebot_plugin_l4d2_server/l4_help/icon//346/257/217/346/234/210.png +0 -0
  32. nonebot_plugin_l4d2_server/l4_help/icon//346/267/261/346/270/212.png +0 -0
  33. nonebot_plugin_l4d2_server/l4_help/icon//346/267/273/345/212/240.png +0 -0
  34. nonebot_plugin_l4d2_server/l4_help/icon//346/270/205/351/231/244.png +0 -0
  35. nonebot_plugin_l4d2_server/l4_help/icon//347/212/266/346/200/201.png +0 -0
  36. nonebot_plugin_l4d2_server/l4_help/icon//347/255/276/345/210/260.png +0 -0
  37. nonebot_plugin_l4d2_server/l4_help/icon//347/273/221/345/256/232.png +0 -0
  38. nonebot_plugin_l4d2_server/l4_help/icon//350/241/250.png +0 -0
  39. nonebot_plugin_l4d2_server/l4_help/icon//350/241/250/346/203/205.png +0 -0
  40. nonebot_plugin_l4d2_server/l4_help/icon//350/247/222/350/211/262.png +0 -0
  41. nonebot_plugin_l4d2_server/l4_help/icon//350/256/260/345/275/225.png +0 -0
  42. nonebot_plugin_l4d2_server/l4_help/icon//351/205/215/347/275/256.png +0 -0
  43. nonebot_plugin_l4d2_server/l4_help/icon//351/207/215/345/220/257.png +0 -0
  44. nonebot_plugin_l4d2_server/l4_help/texture2d/badge.png +0 -0
  45. nonebot_plugin_l4d2_server/l4_help/texture2d/banner.png +0 -0
  46. nonebot_plugin_l4d2_server/l4_help/texture2d/bg.jpg +0 -0
  47. nonebot_plugin_l4d2_server/l4_help/texture2d/button.png +0 -0
  48. nonebot_plugin_l4d2_server/l4_help/texture2d/icon.png +0 -0
  49. nonebot_plugin_l4d2_server/l4_image/__init__.py +4 -4
  50. nonebot_plugin_l4d2_server/l4_image/anne_pil.py +18 -0
  51. nonebot_plugin_l4d2_server/l4_image/convert.py +9 -13
  52. nonebot_plugin_l4d2_server/l4_image/download.py +9 -7
  53. nonebot_plugin_l4d2_server/l4_image/html_img.py +47 -76
  54. nonebot_plugin_l4d2_server/l4_image/image_tools.py +19 -16
  55. nonebot_plugin_l4d2_server/l4_image/img/anne/back.png +0 -0
  56. nonebot_plugin_l4d2_server/l4_image/img/anne/back1.jpg +0 -0
  57. nonebot_plugin_l4d2_server/l4_image/img/head/head.png +0 -0
  58. nonebot_plugin_l4d2_server/l4_image/img/header/logo.png +0 -0
  59. nonebot_plugin_l4d2_server/l4_image/img/header/player1.jpg +0 -0
  60. nonebot_plugin_l4d2_server/l4_image/img/template/Bocchi_The_Rock.html +17 -30
  61. nonebot_plugin_l4d2_server/l4_image/img/template/Bocchi_The_Rock.png +0 -0
  62. nonebot_plugin_l4d2_server/l4_image/img/template/Pixel.html +17 -26
  63. nonebot_plugin_l4d2_server/l4_image/img/template/Pixel.png +0 -0
  64. nonebot_plugin_l4d2_server/l4_image/img/template/Rainbow.html +48 -14
  65. nonebot_plugin_l4d2_server/l4_image/img/template/Rainbow.png +0 -0
  66. nonebot_plugin_l4d2_server/l4_image/img/template/normal.html +14 -24
  67. nonebot_plugin_l4d2_server/{data/img → l4_image/img/template}/vac.png +0 -0
  68. nonebot_plugin_l4d2_server/l4_image/img/template/vac_white.png +0 -0
  69. nonebot_plugin_l4d2_server/l4_image/vtfs.py +3 -3
  70. nonebot_plugin_l4d2_server/l4_local/__init__.py +94 -0
  71. nonebot_plugin_l4d2_server/l4_local/file.py +105 -0
  72. nonebot_plugin_l4d2_server/l4_request/__init__.py +68 -9
  73. nonebot_plugin_l4d2_server/l4_request/draw_msg.py +38 -43
  74. nonebot_plugin_l4d2_server/l4_request/utils.py +0 -0
  75. nonebot_plugin_l4d2_server/utils/api/api.py +8 -2
  76. nonebot_plugin_l4d2_server/utils/api/models.py +108 -0
  77. nonebot_plugin_l4d2_server/utils/api/request.py +257 -39
  78. nonebot_plugin_l4d2_server/utils/database/models.py +12 -23
  79. nonebot_plugin_l4d2_server/utils/utils.py +22 -11
  80. {nonebot_plugin_l4d2_server-1.0.0a1.dist-info → nonebot_plugin_l4d2_server-1.0.0b1.dist-info}/METADATA +19 -11
  81. nonebot_plugin_l4d2_server-1.0.0b1.dist-info/RECORD +98 -0
  82. nonebot_plugin_l4d2_server/data/L4D2/image/head/head.png +0 -0
  83. nonebot_plugin_l4d2_server/data/L4D2/image/header/logo.png +0 -0
  84. nonebot_plugin_l4d2_server/data/L4D2/image/header/player1.jpg +0 -0
  85. nonebot_plugin_l4d2_server/data/L4D2/image/template/anne.html +0 -68
  86. nonebot_plugin_l4d2_server/data/L4D2/image/template/back.png +0 -0
  87. nonebot_plugin_l4d2_server/data/L4D2/image/template/fingerprint.svg +0 -15
  88. nonebot_plugin_l4d2_server/data/L4D2/image/template/group_ip.html +0 -258
  89. nonebot_plugin_l4d2_server/data/L4D2/image/template/help.html +0 -262
  90. nonebot_plugin_l4d2_server/data/L4D2/image/template/help_dack.html +0 -269
  91. nonebot_plugin_l4d2_server/data/L4D2/image/template/ip.html +0 -54
  92. nonebot_plugin_l4d2_server/data/L4D2/image/template/l.svg +0 -10
  93. nonebot_plugin_l4d2_server/data/L4D2/image/template/m.svg +0 -1
  94. nonebot_plugin_l4d2_server/data/L4D2/image/template/vue.css +0 -531
  95. nonebot_plugin_l4d2_server/data/L4D2/image/template/w.svg +0 -1
  96. nonebot_plugin_l4d2_server/data/icon//344/273/213/347/273/215.png +0 -0
  97. nonebot_plugin_l4d2_server/data/icon//344/273/273/345/212/241.png +0 -0
  98. nonebot_plugin_l4d2_server/data/icon//344/277/241/346/201/257.png +0 -0
  99. nonebot_plugin_l4d2_server/data/icon//345/205/254/345/221/212.png +0 -0
  100. nonebot_plugin_l4d2_server/data/icon//345/210/200/345/211/221.png +0 -0
  101. nonebot_plugin_l4d2_server/data/icon//345/210/207/346/215/242.png +0 -0
  102. nonebot_plugin_l4d2_server/data/icon//345/210/240/351/231/244.png +0 -0
  103. nonebot_plugin_l4d2_server/data/icon//345/210/267/346/226/260.png +0 -0
  104. nonebot_plugin_l4d2_server/data/icon//345/215/241/347/273/204.png +0 -0
  105. nonebot_plugin_l4d2_server/data/icon//345/223/252/351/207/214.png +0 -0
  106. nonebot_plugin_l4d2_server/data/icon//345/234/260/345/233/276.png +0 -0
  107. nonebot_plugin_l4d2_server/data/icon//345/257/274/345/205/245.png +0 -0
  108. nonebot_plugin_l4d2_server/data/icon//345/257/274/345/207/272.png +0 -0
  109. nonebot_plugin_l4d2_server/data/icon//345/275/261.png +0 -0
  110. nonebot_plugin_l4d2_server/data/icon//346/213/274/345/233/276.png +0 -0
  111. nonebot_plugin_l4d2_server/data/icon//346/216/242/347/264/242.png +0 -0
  112. nonebot_plugin_l4d2_server/data/icon//346/216/250/351/200/201.png +0 -0
  113. nonebot_plugin_l4d2_server/data/icon//346/224/266/351/233/206.png +0 -0
  114. nonebot_plugin_l4d2_server/data/icon//346/224/273/347/225/245.png +0 -0
  115. nonebot_plugin_l4d2_server/data/icon//346/233/264/346/226/260.png +0 -0
  116. nonebot_plugin_l4d2_server/data/icon//346/235/220/346/226/231.png +0 -0
  117. nonebot_plugin_l4d2_server/data/icon//346/237/245/350/257/242.png +0 -0
  118. nonebot_plugin_l4d2_server/data/icon//346/240/241/351/252/214.png +0 -0
  119. nonebot_plugin_l4d2_server/data/icon//346/257/217/346/234/210.png +0 -0
  120. nonebot_plugin_l4d2_server/data/icon//346/267/261/346/270/212.png +0 -0
  121. nonebot_plugin_l4d2_server/data/icon//346/267/273/345/212/240.png +0 -0
  122. nonebot_plugin_l4d2_server/data/icon//346/270/205/351/231/244.png +0 -0
  123. nonebot_plugin_l4d2_server/data/icon//347/212/266/346/200/201.png +0 -0
  124. nonebot_plugin_l4d2_server/data/icon//347/255/276/345/210/260.png +0 -0
  125. nonebot_plugin_l4d2_server/data/icon//347/273/221/345/256/232.png +0 -0
  126. nonebot_plugin_l4d2_server/data/icon//350/241/250.png +0 -0
  127. nonebot_plugin_l4d2_server/data/icon//350/241/250/346/203/205.png +0 -0
  128. nonebot_plugin_l4d2_server/data/icon//350/247/222/350/211/262.png +0 -0
  129. nonebot_plugin_l4d2_server/data/icon//350/256/260/345/275/225.png +0 -0
  130. nonebot_plugin_l4d2_server/data/icon//351/205/215/347/275/256.png +0 -0
  131. nonebot_plugin_l4d2_server/data/icon//351/207/215/345/220/257.png +0 -0
  132. nonebot_plugin_l4d2_server/data/img/l4d2.png +0 -0
  133. nonebot_plugin_l4d2_server/data/img/linux.png +0 -0
  134. nonebot_plugin_l4d2_server/data/img/white.png +0 -0
  135. nonebot_plugin_l4d2_server/l4_image/img/template//345/276/256/350/275/257/351/233/205/351/273/221.ttf +0 -0
  136. nonebot_plugin_l4d2_server-1.0.0a1.dist-info/RECORD +0 -144
  137. {nonebot_plugin_l4d2_server-1.0.0a1.dist-info → nonebot_plugin_l4d2_server-1.0.0b1.dist-info}/WHEEL +0 -0
  138. {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") # noqa: F401
20
+ require("nonebot_plugin_htmlrender")
21
21
  require("nonebot_plugin_alconna")
22
+ require("nonebot_plugin_tortoise_orm")
22
23
 
23
- from nonebot import require
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 .l4_request import COMMAND, get_ip_server, get_server_detail, reload_ip
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("l4帮助", aliases={"l4help", "l4d2帮助"})
34
- l4_request = on_command("anne", aliases=COMMAND)
35
- l4_reload = on_command("l4重载", aliases={"l4刷新"})
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
- await UniMessage.image(raw=msg).finish()
89
+ if isinstance(msg, bytes):
90
+ await UniMessage.image(raw=msg).finish()
76
91
  else:
77
- await UniMessage.text("没有这个服呢").send()
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
- reload_ip()
90
- logger.success("重载ip完成")
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": "l4全服",
7
- "desc": "返回可以查询的所有服务器组",
8
- "eg": "l4全服",
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": "雀魂切换uid",
23
- "desc": "切换你的雀魂UID",
24
- "eg": "雀魂切换uid123456",
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": "雀魂搜索Wuyi",
38
- "need_ck": true,
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": "雀魂查询1148850",
46
- "need_ck": true,
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.0a1"
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
- "CS2UID",
42
+ "L4插件",
43
43
  f"版本号:{__version__}",
44
44
  help_data,
45
45
  bg_out,
@@ -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], mode="html"):
7
+ async def msg_to_image(server_dict: List[OutServer], mode_: str = "html"):
8
8
  """信息构造图片"""
9
- if mode == "html":
9
+ if mode_ == "html":
10
10
  """用浏览器作图"""
11
11
  return await server_ip_pic(server_dict)
12
- if mode == "pil":
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