nonebot-plugin-cs2match 1.0.0__tar.gz → 1.0.2__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nonebot-plugin-cs2match
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: 实时追踪 Counter-Strike 2 职业赛事,开赛自动提醒、关键赛况与大比分异动推送。
5
5
  Keywords: nonebot,bot,counter-strike,cs2
6
6
  Author: StarsetNight
@@ -12,11 +12,9 @@ Classifier: Operating System :: OS Independent
12
12
  Classifier: Development Status :: 5 - Production/Stable
13
13
  Requires-Dist: aiohttp>=3.13.5
14
14
  Requires-Dist: ayafileio>=1.4.6
15
- Requires-Dist: nonebot-adapter-onebot>=2.4.6
15
+ Requires-Dist: nonebot-adapter-onebot>=2.4.0
16
16
  Requires-Dist: nonebot-plugin-localstore>=0.7.4
17
- Requires-Dist: nonebot2>=2.4.4
18
- Requires-Dist: pydantic>=2.13.4
19
- Requires-Dist: python-dotenv>=1.2.1
17
+ Requires-Dist: nonebot2>=2.2.0
20
18
  Requires-Dist: typst>=0.15.0
21
19
  Requires-Python: >=3.10, <4.0
22
20
  Project-URL: Homepage, https://github.com/StarsetNight/nonebot-plugin-cs2match
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nonebot-plugin-cs2match"
3
- version = "1.0.0"
3
+ version = "1.0.2"
4
4
  description = "实时追踪 Counter-Strike 2 职业赛事,开赛自动提醒、关键赛况与大比分异动推送。"
5
5
  license = "MIT"
6
6
  readme = "README.md"
@@ -18,11 +18,9 @@ requires-python = ">=3.10,<4.0"
18
18
  dependencies = [
19
19
  "aiohttp>=3.13.5",
20
20
  "ayafileio>=1.4.6",
21
- "nonebot-adapter-onebot>=2.4.6",
21
+ "nonebot-adapter-onebot>=2.4.0",
22
22
  "nonebot-plugin-localstore>=0.7.4",
23
- "nonebot2>=2.4.4",
24
- "pydantic>=2.13.4",
25
- "python-dotenv>=1.2.1",
23
+ "nonebot2>=2.2.0",
26
24
  "typst>=0.15.0",
27
25
  ]
28
26
 
@@ -10,18 +10,18 @@ from nonebot.permission import SUPERUSER
10
10
  from nonebot.plugin import PluginMetadata
11
11
 
12
12
  from .config import Config
13
+ # init的配置读取必须先于其他要使用init中配置的导入模块,否则会缺配置读不了
14
+ driver = get_driver()
15
+ global_config = driver.config
16
+ config = get_plugin_config(Config) # 取自config.py中的静态配置
13
17
  from .tools import PandaScoreClient, MonitorClient, MatchParser, typst_render
14
- from .typst_template import help_text
18
+ from .template import help_plain_text, help_text
15
19
  from .rule import is_enabled
16
20
  from .dynamic_config import DynamicConfigSystem, PriorityMode
17
21
 
18
22
  require("nonebot_plugin_localstore")
19
23
  from nonebot_plugin_localstore import get_plugin_data_file
20
24
 
21
- driver = get_driver()
22
- global_config = driver.config
23
- config = get_plugin_config(Config) # 取自config.py中的静态配置
24
-
25
25
  panda_client: PandaScoreClient | None = None
26
26
  dynamic_config: DynamicConfigSystem | None = None # 取自插件内编写的DynamicConfigSystem
27
27
  monitor_client: MonitorClient | None = None
@@ -30,9 +30,12 @@ monitor_client: MonitorClient | None = None
30
30
  __plugin_meta__ = PluginMetadata(
31
31
  name="CS2赛事助手",
32
32
  description="实时追踪 Counter-Strike 2 职业赛事,开赛自动提醒、关键赛况与大比分异动推送",
33
- usage=help_text,
33
+ usage=help_plain_text,
34
+ type="application",
35
+ homepage="https://github.com/StarsetNight/nonebot-plugin-cs2match",
34
36
  config=Config,
35
- extra={}
37
+ supported_adapters={"~onebot.v11"},
38
+ extra={"author": "StarsetNight <starsetnight@outlook.com>"}
36
39
  )
37
40
 
38
41
  @driver.on_startup
@@ -3,9 +3,7 @@
3
3
 
4
4
  import nonebot
5
5
 
6
- from .config import Config
7
-
8
- config = nonebot.get_plugin_config(Config)
6
+ from . import config
9
7
 
10
8
 
11
9
  async def is_enabled():
@@ -1,6 +1,26 @@
1
1
  # Copyright (c) 2026 StarsetNight, XuanRikka
2
2
  # SPDX-License-Identifier: MIT
3
3
 
4
+ # help_plain_text和help_text两边一定要同时改!
5
+
6
+ help_plain_text = """NoneBot CS2赛事查询帮助
7
+
8
+ /cs2help
9
+ 显示此帮助信息。
10
+
11
+ /matches [past|running|upcoming]
12
+ 查询CS2比赛列表,支持查看已结束、进行中和即将开始的比赛。
13
+
14
+ /match <id>
15
+ 查询指定比赛的详细比分信息。
16
+
17
+ /monitor <id>
18
+ 开启比赛监听,自动推送比赛开始、比分变化和结束状态。
19
+ 使用 /monitor cancel 可取消当前监听。
20
+
21
+ /cs2whitelist <on|off>
22
+ 开启或关闭比赛列表白名单过滤。"""
23
+
4
24
  help_text = """#set text(font: ("Consolas", "SimHei"))
5
25
 
6
26
  #set page(
@@ -17,17 +17,12 @@ from ayafileio import open
17
17
  import typst
18
18
 
19
19
  from nonebot.adapters.onebot.v11 import Message, MessageSegment, Bot
20
- from nonebot import require, get_driver, get_plugin_config, logger
20
+ from nonebot import require, logger
21
21
 
22
22
  require("nonebot_plugin_localstore")
23
23
  from nonebot_plugin_localstore import get_plugin_cache_dir
24
24
 
25
- from . import typst_template
26
- from .config import Config
27
-
28
- driver = get_driver()
29
- global_config = driver.config
30
- config = get_plugin_config(Config)
25
+ from . import template, config
31
26
 
32
27
  RENDER_CACHE_DIR = get_plugin_cache_dir() / "render_cache"
33
28
  RENDER_CACHE_DIR.mkdir(exist_ok=True)
@@ -183,7 +178,7 @@ class MonitorClient:
183
178
  message = await typst_render(
184
179
  MatchParser.prerender_match(
185
180
  current,
186
- typst_template.push_comment
181
+ template.push_comment
187
182
  ),
188
183
  "monitor"
189
184
  )
@@ -287,7 +282,7 @@ class MatchParser:
287
282
  reverse=True
288
283
  ))
289
284
 
290
- content = typst_template.list_match
285
+ content = template.list_match
291
286
 
292
287
  for serie_name, serie_matches in sorted_series.items():
293
288
  content += f'#series_card("{serie_name}", [\n'
@@ -374,7 +369,7 @@ class MatchParser:
374
369
 
375
370
  games_text = "\n".join(games)
376
371
 
377
- return f"""{typst_template.get_match}
372
+ return f"""{template.get_match}
378
373
  #let match = (
379
374
  name: "{match.get("name", "未知比赛")}",
380
375
  league: "{(match.get("league") or {}).get("name", "未知赛事")}",