18 Commits

Author SHA1 Message Date
sakuradairong
0acd244cb8 fix: 修复 _pubg_lookup_tool 误传 AiocqhttpMessageEvent 导致 TypeError 崩溃
三层防御:
1. _pubg_lookup_tool 检测 player_name 类型,非 str 时从 AstrMessageEvent 恢复
2. _fetch_all 增加 player_name/platform 类型断言和自动转换
3. _api_request 参数清洗,过滤非 str/int/float 的值

v1.4.2
2026-05-18 16:27:21 +08:00
sakuradairong
26ca2ca6f7 chore: bump to 1.4.1 2026-05-17 19:38:11 +08:00
sakuradairong
4d2e3cfad9 fix: treat ban_type=Innocent as not banned
PUBG API 返回 ban_type='Innocent' 表示账号正常。之前
'Innocent' 不在 _BAN_STATUS_LABELS 中,原样显示
'⚠ 账号状态: Innocent'。现在将其归为 None(正常状态)。
2026-05-17 19:35:45 +08:00
sakuradairong
f41815f46e chore: bump version to 1.4.0 and add CHANGELOG 2026-05-17 19:31:36 +08:00
sakuradairong
825b166615 fix: robust CJK font discovery with fc-list fallback
- Add encoding='unic' when loading TrueType fonts for CJK support
- Fix fc-match invocation (remove invalid --default flag)
- Add fc-list :lang=zh enumeration as last-resort fallback to find
  ANY CJK font available on the system
- Add NotoSerifCJK paths alongside existing Sans variants
2026-05-17 19:30:37 +08:00
sakuradairong
65f8b2e565 fix: improve font loading for CJK text rendering
- Scan local fonts/ directory for any .ttf/.ttc/.otf files first
  (user can drop a CJK font file there)
- Add NotoSerifCJK paths alongside existing Sans variants
- Add fontconfig-based dynamic lookup (fc-match) as fallback
  before resorting to ImageFont.load_default()
- Remove hardcoded NotoSansSC paths from fonts/ that don't exist
2026-05-17 19:26:28 +08:00
sakuradairong
4ccec4096e fix: consolidate stacked @filter.command decorators into single with alias
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.
2026-05-17 19:23:54 +08:00
sakuradairong
9470ad197f feat: register pubg_query as LLM function-calling tool for agent mode
Register the PUBG stats query as an agent-usable tool via
StarTools.register_llm_tool so the AstrBot LLM agent
(tool_loop_agent_runner) can call the official PUBG API directly
instead of scraping web pages when users ask about PUBG stats.

- Add _pubg_lookup_tool bound method that fetches stats via _fetch_all
  and returns formatted text
- Register tool with player_name (required) and platform (optional) params
- Graceful fallback if StarTools registration fails
2026-05-17 19:21:31 +08:00
sakuradairong
fa9aa8d627 fix: update repo references from RainySY to sakuradairong
Original repo no longer exists (404). Point all URLs and author
fields to the active fork.
2026-05-17 19:13:10 +08:00
sakuradairong
868ed2f1e6 fix: handle partial match failures and add per-request timeout
- Add return_exceptions=True to asyncio.gather so one failed match
  doesn't crash the entire query; filter out failed results gracefully.
- Replace session-level timeout with per-request timeout (10s) in
  _api_request to avoid shared time budget across 9 requests.
- Remove session-level ClientTimeout that was too tight for batch.
- Add diagnostic logging at plugin init, query_stats entry, and
  data fetch stages to help trace agent interception issues.
- Support stadia platform in config schema description.
- Add _truncate_text for long player name image rendering.
- Clean up unused mode_key tuple element in mode_rows.
2026-05-17 19:11:43 +08:00
sakuradairong
57812483dd Add README with usage, config, and feature overview 2026-05-17 18:51:59 +08:00
sakuradairong
f6d0c7c26a refactor: restructure repo layout and improve code quality
- Flatten directory: move all plugin files from astrbot_plugin_pubg/ to root
- Add .gitignore, __init__.py, requirements.txt
- Fix metadata version to match code (1.3.0)
- Remove unused Any import and dead variable assignments
- Fix tempfile resource leak on save failure
- Add proper type hints (AstrBotConfig, PIL types)
- Prefix BAN_STATUS_LABELS with underscore for consistency
- Modernize type annotations with from __future__ import annotations
2026-05-17 15:11:25 +08:00
RainySY
48ed800c4b 重构 PUBG 插件,添加玩家信息类,优化 API 请求和渲染逻辑,更新版本号至 1.3.0 2026-04-29 00:42:02 +08:00
RainySY
d801e254f3 删除不再需要的设置文件 settings.local.json 2026-04-22 21:06:54 +08:00
RainySY
07ee85e0e7 添加新的命令“查ID”和“查询”以支持玩家统计查询 2026-04-22 21:02:59 +08:00
RainySY
08cccecf93 修复 PUBG 插件中的统计计算和请求参数,优化代码结构 2026-04-22 20:58:28 +08:00
RainySY
6b96204f98 添加图像渲染功能和文本回退,更新版本号至 1.2.0 2026-04-22 16:49:12 +08:00
RainySY
cbfa85aa2c 添加 PUBG 玩家战绩查询插件,包括配置文件、元数据和主要功能实现 2026-04-22 16:48:26 +08:00