Commit Graph

4 Commits

Author SHA1 Message Date
c62ac37611 review: fix critical/medium bugs in 4 plugins (round 2)
group_horse_racing:
- settle_race: rewrite with 7 bug fixes (race condition, draw double-credit, empty participants, etc.)
- models.py: reorder fields for correct defaults, add indexes
- message_service: add logger import

danding_points:
- api.py: add finally blocks to 3 methods (add_points, get_history, get_leaderboard)
- database.py: add finally block to get_user_balance

chatai:
- __init__.py: deprecated API→asyncio.to_thread, deduplicate logging, taskkill filter for safety
- screenshot.py: XSS protection with bleach on HTML content
- requirements.txt: add bleach dependency

danding_qqpush:
- api.py L13: fix self-referencing _renderer NameError crash
- api.py: lazy singleton pattern via _get_renderer() instead of per-request ImageRenderer
- __init__.py: mask Token in log output (security)

All 34 tests pass.
2026-05-10 00:30:22 +08:00
c01338f496 refactor(plugins): comprehensive code review - ~35 fixes across 14 plugins
Phase 1 - Plugin code review (14/14 plugins):
- Security: 3x token leak in print→logger.debug, Bearer prefix handling
- Bug: bare except→specific exceptions, HorseState type safety, sync→async
- Critical: response_model undefined, route dead code, sync blocking event loop
- Quality: 11x print()→logger, variable name shadowing, consistent logging

Phase 2 - Deep analysis:
- Fix: payout int truncation→max(1, round(amount*odds))
- Fix: room_store get_lock race condition→dict.setdefault()
- Verify: data_manager f-string SQL is safe (uses ? placeholders)

Infrastructure: review reports generated for all plugins.
2026-05-09 23:22:28 +08:00
9895256064 feat(horse_racing): 实现赛马消息更新替换与自动撤回
重构消息发送逻辑,引入消息类型区分和自动撤回机制。赛马进度更新现在会替换前一条更新消息,避免消息刷屏;比赛结果发送前自动撤回最后一条进度更新,提升聊天体验。同时支持配置不同消息类型的自动撤回时间。

- 新增 MessageService.send_with_recall 方法统一处理消息发送和撤回
- 添加 recall_previous_of_type 方法用于撤回特定类型的上一条消息
- 修改 _send_to_scope 函数支持消息类型参数
- 更新测试代码以适配新的消息发送接口
2026-04-07 20:17:00 +08:00
ab1b25e239 功能:实现 Group_Horse_Racing 群赛马插件
- 新增群赛马游戏插件,支持多人参与赛马竞猜

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 00:24:25 +08:00