Skip to main content

nonebot-plugin-cs2radar

NoneBot2 的 CS2 插件,提供职业选手查询、近期赛事/赛果、5E 战绩、完美平台战绩、官匹战绩、账号绑定与单局详细复盘。

安装

使用 nb-cli

nb plugin install nonebot-plugin-cs2radar

使用 pip

pip install nonebot-plugin-cs2radar

安装 Playwright 浏览器

本插件依赖 playwright 渲染图片,请额外执行:

playwright install chromium

适配器

  • OneBot V11

命令

  • cs查询 <选手名>: 查询职业选手资料卡
  • cs赛事: 查询近期赛事与比赛
  • 赛果: 查询近几日赛果
  • 5e [ID/昵称] [-r]: 查询 5E 战绩(无参数默认查绑定,支持 -r 刷新 AI 评价)
  • pwlogin <手机号> <验证码>: 登录完美平台并保存本地会话
  • pw [昵称/SteamID] [-r]: 查询完美平台战绩(无参数默认查绑定,支持 -r 刷新 AI 评价)
  • bind <5e|pw> <玩家名>: 绑定常用查询对象
  • match [5e|pw|mm] [@群友] [局数] [-r]: 查询最近第 N 把详细对局并生成四维复盘

v0.2.0 更新说明

  • 统一战绩卡片视口宽度为 960px,优化排版细节与移动端适配。
  • 5E 平台改用专属橙色主题配色,与完美平台进行视觉区分。
  • 5E 平台改用直连 HTTP 接口获取战绩,移除原有浏览器页面抓取逻辑,提升查询速度与稳定性。
  • 战绩与对局评价支持分模块展示(【战力定位】【技术风格】【武器地图】【进阶建议】)。
  • /pw/5e 支持无参默认查绑或 @群友 查询,新增 -r 参数用于强制刷新战绩与 AI 评价缓存。

配置

环境变量统一使用 cs2radar_* 前缀;旧的 cs_pro_* 前缀当前仍兼容一版,但会打印弃用警告。

cs2radar_llm_enabled=true
cs2radar_llm_api_type=openai
cs2radar_llm_api_url=https://api.openai.com/v1
cs2radar_llm_api_key=
cs2radar_llm_model=gpt-4o-mini

说明:

  • LLM 配置为可选;未配置时仍可查询战绩,只是不生成 AI 复盘。
  • pw / match pw / match mm 依赖完美平台登录态,请先执行 pwlogin

数据存储与迁移

插件默认把数据存储到 nonebot-plugin-localstore 的插件数据目录下,并会尝试自动迁移旧版本的以下文件:

  • data/cs_pro/user_bindings.db
  • data/cs_pro/user_data.db
  • data/cs_pro/user_data.json
  • data/cs_pro/pw_session.json

常见问题

1. 提示找不到浏览器或渲染失败

请确认已经执行过:

playwright install chromium

2. pw 查询提示先登录

这是正常行为。完美平台接口需要有效登录态,请先执行:

pwlogin <手机号> <验证码>

3. AI 复盘没有返回

未配置 LLM Key、模型返回非 JSON、接口超时都会触发降级。此时插件仍会返回战绩图片,只是不附带 AI 结论。

License

MIT

发布

推送语义化标签后会自动触发 GitHub Actions 发布到 PyPI,例如:

git tag v0.1.0
git push origin v0.1.0

工作流优先使用仓库机密 PYPI_API_TOKEN;若未配置该机密,则回退为 PyPI Trusted Publishing。

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nonebot_plugin_cs2radar-0.2.0.tar.gz (52.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nonebot_plugin_cs2radar-0.2.0-py3-none-any.whl (66.5 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_cs2radar-0.2.0.tar.gz.

File metadata

  • Download URL: nonebot_plugin_cs2radar-0.2.0.tar.gz
  • Upload date:
  • Size: 52.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for nonebot_plugin_cs2radar-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ee5303debd6fab339224c41688093722c9b5336957373d5addacfc1e3061db35
MD5 2e8d820e12b7f2548cb7f292444a314a
BLAKE2b-256 85f5661c172daba85b9a7c77b388d884c7412fd01a50bb1905f4e0fb5ed8c7fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for nonebot_plugin_cs2radar-0.2.0.tar.gz:

Publisher: publish.yml on luojisama/nonebot-plugin-cs2radar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nonebot_plugin_cs2radar-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_cs2radar-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b678f882ccc16af2e0830987187cd061b5422819837518d42b44b6174d989d3
MD5 224679d95a1ff618cee39ab66a3f449f
BLAKE2b-256 c6034ba0bee84dcd22105dc70fb8d25a0370b9fd5bf8b2a1e016846107fdd048

See more details on using hashes here.

Provenance

The following attestation bundles were made for nonebot_plugin_cs2radar-0.2.0-py3-none-any.whl:

Publisher: publish.yml on luojisama/nonebot-plugin-cs2radar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.2.1

2 files

This release

0.2.0 This release

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page