4ccec4096e1354302772d680b9c9c74725043ee5
Three stacked @filter.command('pubg'), @filter.command('查ID'),
@filter.command('查询') decorated the same method, but
get_handler_or_create returns the same handler metadata for all
three, appending each CommandFilter to event_filters. In the
WakingCheckStage, all filters are AND'd, so the message would need
to start with all three command names simultaneously - impossible.
Fix: use @filter.command('pubg', alias={'查ID', '查询'}) which creates
a single CommandFilter that matches any of the three command names.
astrbot_plugin_pubg
AstrBot 插件 —— 查询 PUBG(绝地求生)玩家战绩。
通过官方 PUBG API 获取玩家终身战绩与最近对局数据,支持图片渲染(Pillow)与文字回退两种输出模式。
功能
- 查询玩家终身战绩(按模式展示:单排/双排/四排 × TPP/FPP)
- 最近对局列表(击杀、伤害、助攻、爆头、最远击杀、存活时间)
- 自动检测账号封禁状态
- 跨平台支持:steam、psn、xbox、kakao、stadia
- 图片输出(检测到吃鸡时高亮卡片)/ 文字回退
安装
在 AstrBot 的 plugins 目录下添加本仓库:
cd astrbot/plugins
git clone https://github.com/sakuradairong/astrbot_plugin_pubg.git
或下载压缩包解压到 plugins/astrbot_plugin_pubg/ 目录。
依赖
插件会自动加载依赖,但建议手动安装以保证环境完整:
pip install -r requirements.txt
依赖:
astrbot>=3.0— AstrBot 框架aiohttp>=3.9— 异步 HTTP 客户端Pillow>=10.0— 图片渲染(可选,缺失时自动回退文字输出)
配置
在 AstrBot 管理面板中为插件填写配置:
_conf_schema.json 字段
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
api_key |
string | "" |
PUBG API Key(必须) |
default_platform |
string | "steam" |
默认查询平台 |
获取 API Key
- 访问 PUBG Developer Portal
- 注册账号并创建应用
- 复制生成的 API Key
- 在插件配置中填写
api_key
使用
命令
/pubg <玩家名> [平台]
/查ID <玩家名> [平台]
/查询 <玩家名> [平台]
<玩家名>— PUBG 游戏内昵称(必需)[平台]— 可选,默认steam。支持:steam、psn、xbox、kakao、stadia
示例
/pubg shroud steam
/查ID Shroud
/pubg player_name psn
输出说明
图片模式(已安装 Pillow)
- 头部:玩家名、平台、查询时间
- 封禁状态栏(如有):红色/黄色警示
- 终身战绩卡片:各模式的场次、胜率、Top10 率、K/D、场均伤害、场均存活时间
- 最近对局卡片:排名(吃鸡高亮绿色)、击杀、伤害等详情
文字模式(未安装 Pillow)
内容同图片模式,纯文字排版,适用于不支持图片的平台。
数据来源
本插件使用 PUBG API 官方接口,数据来源于 PUBG 游戏服务器。
LICENSE
本项目代码仅供学习参考,使用请遵守相关法律法规及 PUBG API 使用条款。
Description
Languages
Python
100%