nonebot-plugin-cs2match 1.0.0__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.
@@ -0,0 +1,556 @@
1
+ # Copyright (c) 2026 StarsetNight, XuanRikka
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ help_text = """#set text(font: ("Consolas", "SimHei"))
5
+
6
+ #set page(
7
+ width: 400pt,
8
+ height: auto,
9
+ margin: 12pt,
10
+ )
11
+
12
+ #let primary = rgb("#3b82f6")
13
+ #let border = rgb("#e5e7eb")
14
+ #let bg = rgb("#f8fafc")
15
+
16
+ // ===== 顶部标题栏 =====
17
+ #box(
18
+ width: 100%,
19
+ fill: rgb("#0d005e"),
20
+ inset: 12pt,
21
+ radius: 6pt,
22
+ [
23
+ #text(
24
+ size: 11pt,
25
+ fill: white,
26
+ weight: "bold"
27
+ )[
28
+ NoneBot CS2赛事查询帮助
29
+ ]
30
+ ]
31
+ )
32
+
33
+ #v(10pt)
34
+
35
+ // ===== 卡片组件 =====
36
+ #let card(title, desc) = {
37
+ box(
38
+ width: 100%,
39
+ stroke: 0.5pt + border,
40
+ radius: 8pt,
41
+ inset: 10pt,
42
+ fill: white,
43
+
44
+ [
45
+ // 命令标签(更明显 UI 化)
46
+ #box(
47
+ stroke: rgb("#bfdbfe"),
48
+ fill: rgb("#eff6ff"),
49
+ radius: 4pt,
50
+ inset: 8pt,
51
+ text(
52
+ size: 9pt,
53
+ fill: primary
54
+ )[
55
+ #title
56
+ ]
57
+ )
58
+
59
+ #v(6pt)
60
+
61
+ #text(size: 9pt, fill: rgb("#2a2a2a"))[
62
+ #desc
63
+ ]
64
+ ]
65
+ )
66
+ }
67
+
68
+ // ===== 内容区域 =====
69
+ #grid(
70
+ columns: 1,
71
+ row-gutter: 8pt,
72
+
73
+ card(
74
+ "cs2help / cs2帮助",
75
+ "显示帮助。"
76
+ ),
77
+
78
+ card(
79
+ "matches [past/running/upcoming] / 比赛列表",
80
+ "比赛列表(过去 / 进行中 / 即将开始)。"
81
+ ),
82
+
83
+ card(
84
+ "match <id> / 比分",
85
+ "查看比赛大比分详情。"
86
+ ),
87
+
88
+ card(
89
+ "monitor <id> / 监视",
90
+ "监视比赛开始、比分变动、结束,参数为“cancel”时取消监听。"
91
+ ),
92
+
93
+ card(
94
+ "cs2whitelist <on/off> / 白名单",
95
+ "设置比赛列表是否仅显示白名单赛事系列。"
96
+ ),
97
+ )
98
+ """
99
+
100
+ list_match = """#set text(font: ("Consolas", "SimHei"))
101
+
102
+ #set page(
103
+ width: 320pt,
104
+ height: auto,
105
+ margin: 12pt,
106
+ )
107
+
108
+ #let primary = rgb("#3b82f6")
109
+ #let border = rgb("#e5e7eb")
110
+ #let gray = rgb("#6b7280")
111
+
112
+ // =====================
113
+ // 顶部栏
114
+ // =====================
115
+ #box(
116
+ width: 100%,
117
+ fill: rgb("#3a67a7"),
118
+ inset: 12pt,
119
+ radius: 6pt,
120
+ [
121
+ #text(
122
+ size: 11pt,
123
+ fill: white,
124
+ weight: "bold"
125
+ )[
126
+ Counter-Strike 2 赛事列表查询
127
+ ]
128
+ ]
129
+ )
130
+
131
+ #v(10pt)
132
+
133
+
134
+ // =====================
135
+ // 状态标签
136
+ // =====================
137
+ #let tag(label, color) = box(
138
+ fill: color,
139
+ radius: 5pt,
140
+ inset: 4pt,
141
+ text(size: 8pt, fill: white)[#label]
142
+ )
143
+
144
+ #let not_started = tag("未开始", rgb("#f59e0b"))
145
+ #let running = tag("进行中", rgb("#ef4444"))
146
+ #let finished = tag("已结束", rgb("#10b981"))
147
+ #let canceled = tag("取消", rgb("#6b7280"))
148
+ #let postponed = tag("延期", rgb("#3b82f6"))
149
+
150
+
151
+ // =====================
152
+ // 赛事卡片
153
+ // =====================
154
+ #let match_card(slug, time, team_a, score_a, score_b, team_b, status) = [
155
+ #box(
156
+ width: 100%,
157
+ stroke: 0.5pt + border,
158
+ radius: 8pt,
159
+ inset: 10pt,
160
+ fill: white,
161
+
162
+ [
163
+
164
+ // =====================
165
+ // HEADER(赛事名 + 时间)
166
+ // =====================
167
+ #grid(
168
+ columns: (1fr, auto),
169
+
170
+ [
171
+ #v(2pt)
172
+ #text(
173
+ size: 10pt,
174
+ fill: rgb("#363636"),
175
+ weight: "bold"
176
+ )[#time]
177
+ ],
178
+
179
+ // =====================
180
+ // STATUS
181
+ // =====================
182
+ [#status],
183
+ )
184
+
185
+ #v(6pt)
186
+
187
+ // =====================
188
+ // MATCH ROW(核心比赛信息)
189
+ // =====================
190
+ #grid(
191
+ columns: (1fr, auto, 1fr),
192
+ align: center,
193
+
194
+ // 左队
195
+ [
196
+ #text(
197
+ fill: rgb("#3b82f6"),
198
+ weight: "bold"
199
+ )[#team_a]
200
+ ],
201
+
202
+ // 比分
203
+ [
204
+ #text(
205
+ size: 14pt,
206
+ weight: "bold",
207
+ fill: rgb("#250058")
208
+ )[
209
+ #score_a - #score_b
210
+ ]
211
+ ],
212
+
213
+ // 右队
214
+ [
215
+ #text(
216
+ fill: rgb("#ef4444"),
217
+ weight: "bold"
218
+ )[#team_b]
219
+ ]
220
+ )
221
+
222
+ #v(6pt)
223
+
224
+ #text(
225
+ size: 6pt,
226
+ fill: rgb("#a7a7a7")
227
+ )[#slug]
228
+ ]
229
+ )
230
+
231
+ #v(10pt)
232
+ ]
233
+
234
+ #let series_card(title, body) = [
235
+ #box(
236
+ width: 100%,
237
+ stroke: 0.7pt + rgb("#d1d5db"),
238
+ radius: 10pt,
239
+ fill: rgb("#f8fafc"),
240
+ inset: 10pt,
241
+
242
+ [
243
+ #text(
244
+ size: 11pt,
245
+ weight: "bold",
246
+ fill: primary,
247
+ )[
248
+ #title
249
+ ]
250
+
251
+ #v(8pt)
252
+
253
+ #body
254
+ ]
255
+ )
256
+
257
+ #v(12pt)
258
+ ]
259
+
260
+ """
261
+
262
+ get_match = """#set text(font: ("Consolas", "SimHei"))
263
+
264
+ #set page(
265
+ width: 320pt,
266
+ height: auto,
267
+ margin: 12pt,
268
+ )
269
+
270
+ // =====================
271
+ // STATUS MAP
272
+ // =====================
273
+ #let status_map = (
274
+ "not_started": (
275
+ text: "未开始",
276
+ color: rgb(245, 158, 11),
277
+ ),
278
+ "running": (
279
+ text: "进行中",
280
+ color: rgb(239, 68, 68),
281
+ ),
282
+ "finished": (
283
+ text: "已结束",
284
+ color: rgb(16, 185, 129),
285
+ ),
286
+ "canceled": (
287
+ text: "已取消",
288
+ color: rgb(107, 114, 128),
289
+ ),
290
+ "postponed": (
291
+ text: "已延期",
292
+ color: rgb(59, 130, 246),
293
+ ),
294
+ "unknown": (
295
+ text: "未知",
296
+ color: rgb(156, 163, 175),
297
+ ),
298
+ )
299
+
300
+
301
+ // =====================
302
+ // MATCH DETAIL
303
+ // =====================
304
+ #let match_detail(m) = [
305
+
306
+ #let s = status_map.at(
307
+ m.status,
308
+ default: status_map.at("unknown")
309
+ )
310
+
311
+ // =====================
312
+ // MAIN CARD
313
+ // =====================
314
+ #box(
315
+ width: 100%,
316
+ stroke: 0.6pt + rgb(229, 231, 235),
317
+ radius: 12pt,
318
+ inset: 12pt,
319
+
320
+ [
321
+
322
+ // =====================
323
+ // TOP INFO CARD
324
+ // =====================
325
+ #box(
326
+ width: 100%,
327
+ fill: rgb(248, 250, 252),
328
+ stroke: 0.5pt + rgb(229, 231, 235),
329
+ radius: 10pt,
330
+ inset: 10pt,
331
+
332
+ [
333
+
334
+ #grid(
335
+ columns: (1fr, auto),
336
+
337
+ [
338
+ #text(
339
+ size: 11pt,
340
+ weight: "bold",
341
+ )[
342
+ #m.name
343
+ ]
344
+
345
+ #v(3pt)
346
+
347
+ #text(
348
+ size: 8pt,
349
+ fill: rgb(107,114,128),
350
+ )[
351
+ #m.league · #m.serie
352
+ ]
353
+
354
+ #v(3pt)
355
+
356
+ #text(
357
+ size: 8pt,
358
+ fill: rgb(107,114,128),
359
+ )[
360
+ 时间: #m.time
361
+ ]
362
+ ],
363
+
364
+ [
365
+ #text(
366
+ size: 8pt,
367
+ fill: s.color,
368
+ weight: "bold",
369
+ )[
370
+ #s.text
371
+ ]
372
+
373
+ #v(4pt)
374
+
375
+ #text(
376
+ size: 8pt,
377
+ fill: rgb(107,114,128),
378
+ )[
379
+ BO#m.bo
380
+ ]
381
+ ]
382
+ )
383
+ ]
384
+ )
385
+
386
+
387
+ #v(12pt)
388
+
389
+
390
+ // =====================
391
+ // TEAM SCORE
392
+ // =====================
393
+ #grid(
394
+ columns: (1fr, auto, 1fr),
395
+ align: center + horizon,
396
+
397
+ [
398
+ #box(
399
+ width: 80pt,
400
+ align(center + horizon)[
401
+ #text(
402
+ size: 12pt,
403
+ weight: "bold",
404
+ fill: rgb(37, 99, 235),
405
+ )[
406
+ #m.team_a
407
+ ]
408
+ ]
409
+ )
410
+ ],
411
+
412
+ [
413
+ #box(
414
+ fill: rgb(17, 24, 39),
415
+ radius: 8pt,
416
+ inset: 10pt,
417
+ align(center + horizon)[
418
+ #text(
419
+ size: 12pt,
420
+ weight: "bold",
421
+ fill: white,
422
+ )[
423
+ #m.score_a - #m.score_b
424
+ ]
425
+ ]
426
+ )
427
+ ],
428
+
429
+ [
430
+ #box(
431
+ width: 80pt,
432
+ align(center + horizon)[
433
+ #text(
434
+ size: 12pt,
435
+ weight: "bold",
436
+ fill: rgb(239, 68, 68),
437
+ )[
438
+ #m.team_b
439
+ ]
440
+ ]
441
+ )
442
+ ]
443
+ )
444
+
445
+
446
+ #v(12pt)
447
+
448
+
449
+ // =====================
450
+ // MAP LIST CARD
451
+ // =====================
452
+ #box(
453
+ width: 100%,
454
+ fill: rgb(250,250,250),
455
+ stroke: 0.5pt + rgb(229,231,235),
456
+ radius: 10pt,
457
+ inset: 10pt,
458
+
459
+ [
460
+
461
+ #text(
462
+ size: 9pt,
463
+ weight: "bold",
464
+ )[
465
+ 地图列表
466
+ ]
467
+
468
+ #v(6pt)
469
+
470
+
471
+ #if m.games.len() == 0 [
472
+
473
+ #text(
474
+ size: 8pt,
475
+ fill: rgb(156,163,175),
476
+ )[
477
+ 暂无地图数据
478
+ ]
479
+
480
+ ]
481
+
482
+
483
+ #for g in m.games [
484
+
485
+ #let gs = status_map.at(
486
+ g.status,
487
+ default: status_map.at("unknown")
488
+ )
489
+
490
+
491
+ #grid(
492
+ columns: (1fr, 1fr, 1fr),
493
+ align: center,
494
+
495
+ [
496
+ #text(
497
+ size: 8pt,
498
+ fill: rgb(156,163,175),
499
+ )[
500
+ 地图 #g.position
501
+ ]
502
+ ],
503
+
504
+ [
505
+ #text(
506
+ size: 8pt,
507
+ )[
508
+ #g.winner 胜出
509
+ ]
510
+ ],
511
+
512
+ [
513
+ #text(
514
+ size: 8pt,
515
+ fill: gs.color,
516
+ )[
517
+ #gs.text
518
+ ]
519
+ ]
520
+ )
521
+
522
+ #v(4pt)
523
+ ]
524
+ ]
525
+ )
526
+ ]
527
+ )
528
+ ]
529
+ """
530
+
531
+ push_comment = """#box(
532
+ width: 100%,
533
+ fill: rgb("#eff6ff"),
534
+ stroke: 0.5pt + rgb("#93c5fd"),
535
+ radius: 8pt,
536
+ inset: 8pt,
537
+ )[
538
+ #text(
539
+ size: 9pt,
540
+ fill: rgb("#2563eb"),
541
+ weight: "bold",
542
+ )[
543
+ 自动推送
544
+ ]
545
+
546
+ #v(3pt)
547
+
548
+ #text(
549
+ size: 8pt,
550
+ fill: rgb("#64748b"),
551
+ )[
552
+ 比赛状态发生变化,已自动发送最新赛况!
553
+ ]
554
+ ]
555
+
556
+ #v(10pt)"""
@@ -0,0 +1,106 @@
1
+ Metadata-Version: 2.4
2
+ Name: nonebot-plugin-cs2match
3
+ Version: 1.0.0
4
+ Summary: 实时追踪 Counter-Strike 2 职业赛事,开赛自动提醒、关键赛况与大比分异动推送。
5
+ Keywords: nonebot,bot,counter-strike,cs2
6
+ Author: StarsetNight
7
+ Author-email: StarsetNight <starsetnight@outlook.com>
8
+ License-Expression: MIT
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Requires-Dist: aiohttp>=3.13.5
14
+ Requires-Dist: ayafileio>=1.4.6
15
+ Requires-Dist: nonebot-adapter-onebot>=2.4.6
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
20
+ Requires-Dist: typst>=0.15.0
21
+ Requires-Python: >=3.10, <4.0
22
+ Project-URL: Homepage, https://github.com/StarsetNight/nonebot-plugin-cs2match
23
+ Project-URL: Repository, https://github.com/StarsetNight/nonebot-plugin-cs2match
24
+ Description-Content-Type: text/markdown
25
+
26
+ # nonebot-plugin-cs2match
27
+
28
+ _✨ CS2赛事查询 ✨_
29
+
30
+
31
+ <a href="./LICENSE">
32
+ <img src="https://img.shields.io/github/license/StarsetNight/nonebot-plugin-cs2match.svg" alt="license">
33
+ </a>
34
+ <a href="https://pypi.python.org/pypi/nonebot-plugin-cs2match">
35
+ <img src="https://img.shields.io/pypi/v/nonebot-plugin-cs2match.svg" alt="pypi">
36
+ </a>
37
+ <img src="https://img.shields.io/badge/python-3.10+-blue.svg" alt="python">
38
+
39
+ ## 📖 介绍
40
+
41
+ 实时追踪 Counter-Strike 2 职业赛事,进行开赛自动提醒与大比分异动推送。
42
+
43
+ ## 💿 安装
44
+
45
+ <details open>
46
+ <summary>使用 nb-cli 安装</summary>
47
+ 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
48
+
49
+ nb plugin install nonebot-plugin-cs2match
50
+
51
+ </details>
52
+
53
+ <details>
54
+ <summary>使用包管理器安装</summary>
55
+ 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
56
+
57
+ <details>
58
+ <summary>pip</summary>
59
+
60
+ pip install nonebot-plugin-cs2match
61
+ </details>
62
+ <details>
63
+ <summary>pdm</summary>
64
+
65
+ pdm add nonebot-plugin-cs2match
66
+ </details>
67
+ <details>
68
+ <summary>poetry</summary>
69
+
70
+ poetry add nonebot-plugin-cs2match
71
+ </details>
72
+ <details>
73
+ <summary>conda</summary>
74
+
75
+ conda install nonebot-plugin-cs2match
76
+ </details>
77
+
78
+ 打开 nonebot2 项目根目录下的 `pyproject.toml` 文件, 在 `[tool.nonebot]` 部分追加写入
79
+
80
+ plugins = ["nonebot_plugin_cs2match"]
81
+
82
+ </details>
83
+
84
+ ## ⚙️ 配置
85
+
86
+ 在插件的`config.py`文件中修改下表中的配置
87
+
88
+ | 配置项 | 必配置 | 默认值 | 说明 |
89
+ |:----------------:|:---:|:---:|:-----------------------------:|
90
+ | pandascore_token | 是 | 无 | PandaScore提供商获取的Token |
91
+ | serie_rules | 否 | 见文件 | 按照优先级给赛事系列排序(同时也是赛事系列白名单) |
92
+ | client_timeout | 否 | 10 | API调用客户端最大超时限制,单位为秒 |
93
+ | cache_ttl | 否 | 60 | api请求临时缓存存活时间及比赛监视检测间隔时间,单位为秒 |
94
+ | cache_max_size | 否 | 64 | 临时渲染缓存队列中最多存储数 |
95
+
96
+ 部分运行时配置(DynamicConfig)仅开放运行时修改,详情查阅[指令表](#指令表)
97
+
98
+ ## 🎉 使用
99
+ ### 指令表
100
+ | 指令 | 权限 | 需要@ | 范围 | 说明 |
101
+ |:---------------------------------:|:------------:|:---:|:--:|:---------------------------------------------------:|
102
+ | `cs2help` / `cs2帮助` | 所有人 | 否 | 任何 | 获取插件命令用法 |
103
+ | `matches [past/running/upcoming]` | 所有人 | 否 | 任何 | 比赛列表获取。`matches`可用`比赛列表`代替。 |
104
+ | `match <id>` | 所有人 | 否 | 任何 | 比赛大比分获取。`match`可用`比分`代替。 |
105
+ | `monitor <id>` | 群管/SUPERUSER | 否 | 群聊 | 监视比赛开始、大比分变动、结束,参数为“cancel”时取消监听。`monitor`可用`监视`代替。 |
106
+ | `cs2whitelist <on/off>` | 群管/SUPERUSER | 否 | 任何 | 设置比赛列表是否仅显示白名单赛事系列。`cs2whitelist`可用`白名单`代替。 |
@@ -0,0 +1,9 @@
1
+ nonebot_plugin_cs2match/__init__.py,sha256=VzPFxvf_TCxh9J8Aqx7L-hj33p1AeRhJvDJLrfqcQYY,6883
2
+ nonebot_plugin_cs2match/config.py,sha256=h8jc64794LcqSkmlYPvUQ3tnNXE4BhxD73p-cMqGiRk,616
3
+ nonebot_plugin_cs2match/dynamic_config.py,sha256=kCDTmclVUTTetiT1D3lejt5wcT__EJkRKW3J9wid1wE,1283
4
+ nonebot_plugin_cs2match/rule.py,sha256=s_bjR07prBEF11C1cVX7gjbt0a62wI33c5Z2jJRlYZQ,289
5
+ nonebot_plugin_cs2match/tools.py,sha256=ZFOYCpl1JH4hx3G539faQ9igRQwkhIGjcfHJ6BxVnZ8,16166
6
+ nonebot_plugin_cs2match/typst_template.py,sha256=NrmvFvP1PNm4uU6ezIK7pDpUBvjk_7F2OkkLGvSWEUw,9605
7
+ nonebot_plugin_cs2match-1.0.0.dist-info/WHEEL,sha256=CoDSoyhtC_eO_tlxRYzsTraPv1fPJRXFx91k6ISeAvA,81
8
+ nonebot_plugin_cs2match-1.0.0.dist-info/METADATA,sha256=p38sB31-usVFqk6qEToru8ZpbkSNlF6fp1nDYOLNNro,4445
9
+ nonebot_plugin_cs2match-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.11.28
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any