nonebot-plugin-cs2radar 0.1.0__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.
- nonebot_plugin_cs2radar-0.1.0/.gitignore +12 -0
- nonebot_plugin_cs2radar-0.1.0/LICENSE +21 -0
- nonebot_plugin_cs2radar-0.1.0/PKG-INFO +137 -0
- nonebot_plugin_cs2radar-0.1.0/README.md +104 -0
- nonebot_plugin_cs2radar-0.1.0/nonebot_plugin_cs2radar/__init__.py +485 -0
- nonebot_plugin_cs2radar-0.1.0/nonebot_plugin_cs2radar/binding_store.py +197 -0
- nonebot_plugin_cs2radar-0.1.0/nonebot_plugin_cs2radar/config.py +120 -0
- nonebot_plugin_cs2radar-0.1.0/nonebot_plugin_cs2radar/crawler.py +614 -0
- nonebot_plugin_cs2radar-0.1.0/nonebot_plugin_cs2radar/llm.py +227 -0
- nonebot_plugin_cs2radar-0.1.0/nonebot_plugin_cs2radar/match_service.py +1052 -0
- nonebot_plugin_cs2radar-0.1.0/nonebot_plugin_cs2radar/renderer.py +173 -0
- nonebot_plugin_cs2radar-0.1.0/nonebot_plugin_cs2radar/storage.py +51 -0
- nonebot_plugin_cs2radar-0.1.0/nonebot_plugin_cs2radar/templates/events.html +179 -0
- nonebot_plugin_cs2radar-0.1.0/nonebot_plugin_cs2radar/templates/match_detail.html +326 -0
- nonebot_plugin_cs2radar-0.1.0/nonebot_plugin_cs2radar/templates/match_results.html +291 -0
- nonebot_plugin_cs2radar-0.1.0/nonebot_plugin_cs2radar/templates/matches.html +301 -0
- nonebot_plugin_cs2radar-0.1.0/nonebot_plugin_cs2radar/templates/player_detail.html +424 -0
- nonebot_plugin_cs2radar-0.1.0/nonebot_plugin_cs2radar/templates/pw_stats.html +344 -0
- nonebot_plugin_cs2radar-0.1.0/nonebot_plugin_cs2radar/templates/stats.html +307 -0
- nonebot_plugin_cs2radar-0.1.0/pyproject.toml +66 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 luojisama
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nonebot-plugin-cs2radar
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: NoneBot2 CS2 雷达插件,支持赛事/选手、5E、完美与官匹战绩查询及对局分析
|
|
5
|
+
Project-URL: Homepage, https://github.com/luojisama/nonebot-plugin-cs2radar
|
|
6
|
+
Project-URL: Repository, https://github.com/luojisama/nonebot-plugin-cs2radar
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/luojisama/nonebot-plugin-cs2radar/issues
|
|
8
|
+
Author-email: luojisama <2534316454@qq.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: 5e,cs2,csgo,nonebot,nonebot2,onebot,perfectworld
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Framework :: AsyncIO
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Communications :: Chat
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: httpx>=0.23.0
|
|
25
|
+
Requires-Dist: jinja2>=3.0.0
|
|
26
|
+
Requires-Dist: nonebot-adapter-onebot>=2.2.0
|
|
27
|
+
Requires-Dist: nonebot-plugin-htmlrender>=0.6.0
|
|
28
|
+
Requires-Dist: nonebot-plugin-localstore>=0.6.0
|
|
29
|
+
Requires-Dist: nonebot2>=2.2.0
|
|
30
|
+
Requires-Dist: playwright>=1.30.0
|
|
31
|
+
Requires-Dist: pydantic<3.0,>=1.10
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# nonebot-plugin-cs2radar
|
|
35
|
+
|
|
36
|
+
NoneBot2 的 CS2 插件,提供职业选手查询、近期赛事/赛果、5E 战绩、完美平台战绩、官匹战绩、账号绑定与单局详细复盘。
|
|
37
|
+
|
|
38
|
+
## 安装
|
|
39
|
+
|
|
40
|
+
### 使用 nb-cli
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
nb plugin install nonebot-plugin-cs2radar
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 使用 pip
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install nonebot-plugin-cs2radar
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 安装 Playwright 浏览器
|
|
53
|
+
|
|
54
|
+
本插件依赖 `playwright` 渲染图片,请额外执行:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
playwright install chromium
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## 适配器
|
|
61
|
+
|
|
62
|
+
- `OneBot V11`
|
|
63
|
+
|
|
64
|
+
## 命令
|
|
65
|
+
|
|
66
|
+
- `cs查询 <选手名>`: 查询职业选手资料卡
|
|
67
|
+
- `cs赛事`: 查询近期赛事与比赛
|
|
68
|
+
- `赛果`: 查询近几日赛果
|
|
69
|
+
- `5e <ID/昵称>`: 查询 5E 战绩
|
|
70
|
+
- `pwlogin <手机号> <验证码>`: 登录完美平台并保存本地会话
|
|
71
|
+
- `pw <昵称/SteamID>`: 查询完美平台战绩
|
|
72
|
+
- `bind <5e|pw> <玩家名>`: 绑定常用查询对象
|
|
73
|
+
- `match [5e|pw|mm] [@群友] [局数]`: 查询最近第 N 把详细对局并生成复盘
|
|
74
|
+
|
|
75
|
+
## 配置
|
|
76
|
+
|
|
77
|
+
环境变量统一使用 `cs2radar_*` 前缀;旧的 `cs_pro_*` 前缀当前仍兼容一版,但会打印弃用警告。
|
|
78
|
+
|
|
79
|
+
```env
|
|
80
|
+
cs2radar_llm_enabled=true
|
|
81
|
+
cs2radar_llm_api_type=openai
|
|
82
|
+
cs2radar_llm_api_url=https://api.openai.com/v1
|
|
83
|
+
cs2radar_llm_api_key=
|
|
84
|
+
cs2radar_llm_model=gpt-4o-mini
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
说明:
|
|
89
|
+
|
|
90
|
+
- LLM 配置为可选;未配置时仍可查询战绩,只是不生成 AI 复盘。
|
|
91
|
+
- `pw` / `match pw` / `match mm` 依赖完美平台登录态,请先执行 `pwlogin`。
|
|
92
|
+
|
|
93
|
+
## 数据存储与迁移
|
|
94
|
+
|
|
95
|
+
插件默认把数据存储到 `nonebot-plugin-localstore` 的插件数据目录下,并会尝试自动迁移旧版本的以下文件:
|
|
96
|
+
|
|
97
|
+
- `data/cs_pro/user_bindings.db`
|
|
98
|
+
- `data/cs_pro/user_data.db`
|
|
99
|
+
- `data/cs_pro/user_data.json`
|
|
100
|
+
- `data/cs_pro/pw_session.json`
|
|
101
|
+
|
|
102
|
+
## 常见问题
|
|
103
|
+
|
|
104
|
+
### 1. 提示找不到浏览器或渲染失败
|
|
105
|
+
|
|
106
|
+
请确认已经执行过:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
playwright install chromium
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 2. `pw` 查询提示先登录
|
|
113
|
+
|
|
114
|
+
这是正常行为。完美平台接口需要有效登录态,请先执行:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pwlogin <手机号> <验证码>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 3. AI 复盘没有返回
|
|
121
|
+
|
|
122
|
+
未配置 LLM Key、模型返回非 JSON、接口超时都会触发降级。此时插件仍会返回战绩图片,只是不附带 AI 结论。
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
|
|
126
|
+
MIT
|
|
127
|
+
|
|
128
|
+
## 发布
|
|
129
|
+
|
|
130
|
+
推送语义化标签后会自动触发 GitHub Actions 发布到 PyPI,例如:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
git tag v0.1.0
|
|
134
|
+
git push origin v0.1.0
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
工作流优先使用仓库机密 `PYPI_API_TOKEN`;若未配置该机密,则回退为 PyPI Trusted Publishing。
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# nonebot-plugin-cs2radar
|
|
2
|
+
|
|
3
|
+
NoneBot2 的 CS2 插件,提供职业选手查询、近期赛事/赛果、5E 战绩、完美平台战绩、官匹战绩、账号绑定与单局详细复盘。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
### 使用 nb-cli
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
nb plugin install nonebot-plugin-cs2radar
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### 使用 pip
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install nonebot-plugin-cs2radar
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### 安装 Playwright 浏览器
|
|
20
|
+
|
|
21
|
+
本插件依赖 `playwright` 渲染图片,请额外执行:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
playwright install chromium
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 适配器
|
|
28
|
+
|
|
29
|
+
- `OneBot V11`
|
|
30
|
+
|
|
31
|
+
## 命令
|
|
32
|
+
|
|
33
|
+
- `cs查询 <选手名>`: 查询职业选手资料卡
|
|
34
|
+
- `cs赛事`: 查询近期赛事与比赛
|
|
35
|
+
- `赛果`: 查询近几日赛果
|
|
36
|
+
- `5e <ID/昵称>`: 查询 5E 战绩
|
|
37
|
+
- `pwlogin <手机号> <验证码>`: 登录完美平台并保存本地会话
|
|
38
|
+
- `pw <昵称/SteamID>`: 查询完美平台战绩
|
|
39
|
+
- `bind <5e|pw> <玩家名>`: 绑定常用查询对象
|
|
40
|
+
- `match [5e|pw|mm] [@群友] [局数]`: 查询最近第 N 把详细对局并生成复盘
|
|
41
|
+
|
|
42
|
+
## 配置
|
|
43
|
+
|
|
44
|
+
环境变量统一使用 `cs2radar_*` 前缀;旧的 `cs_pro_*` 前缀当前仍兼容一版,但会打印弃用警告。
|
|
45
|
+
|
|
46
|
+
```env
|
|
47
|
+
cs2radar_llm_enabled=true
|
|
48
|
+
cs2radar_llm_api_type=openai
|
|
49
|
+
cs2radar_llm_api_url=https://api.openai.com/v1
|
|
50
|
+
cs2radar_llm_api_key=
|
|
51
|
+
cs2radar_llm_model=gpt-4o-mini
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
说明:
|
|
56
|
+
|
|
57
|
+
- LLM 配置为可选;未配置时仍可查询战绩,只是不生成 AI 复盘。
|
|
58
|
+
- `pw` / `match pw` / `match mm` 依赖完美平台登录态,请先执行 `pwlogin`。
|
|
59
|
+
|
|
60
|
+
## 数据存储与迁移
|
|
61
|
+
|
|
62
|
+
插件默认把数据存储到 `nonebot-plugin-localstore` 的插件数据目录下,并会尝试自动迁移旧版本的以下文件:
|
|
63
|
+
|
|
64
|
+
- `data/cs_pro/user_bindings.db`
|
|
65
|
+
- `data/cs_pro/user_data.db`
|
|
66
|
+
- `data/cs_pro/user_data.json`
|
|
67
|
+
- `data/cs_pro/pw_session.json`
|
|
68
|
+
|
|
69
|
+
## 常见问题
|
|
70
|
+
|
|
71
|
+
### 1. 提示找不到浏览器或渲染失败
|
|
72
|
+
|
|
73
|
+
请确认已经执行过:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
playwright install chromium
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 2. `pw` 查询提示先登录
|
|
80
|
+
|
|
81
|
+
这是正常行为。完美平台接口需要有效登录态,请先执行:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
pwlogin <手机号> <验证码>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 3. AI 复盘没有返回
|
|
88
|
+
|
|
89
|
+
未配置 LLM Key、模型返回非 JSON、接口超时都会触发降级。此时插件仍会返回战绩图片,只是不附带 AI 结论。
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
MIT
|
|
94
|
+
|
|
95
|
+
## 发布
|
|
96
|
+
|
|
97
|
+
推送语义化标签后会自动触发 GitHub Actions 发布到 PyPI,例如:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
git tag v0.1.0
|
|
101
|
+
git push origin v0.1.0
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
工作流优先使用仓库机密 `PYPI_API_TOKEN`;若未配置该机密,则回退为 PyPI Trusted Publishing。
|