Conversation
# Conflicts: # GUGUbot/gugubot/__init__.py # GUGUbot/gugubot/constant/normal.yml # GUGUbot/gugubot/logic/system/__init__.py # GUGUbot/gugubot/utils/__init__.py
Review Summary by QodoAdd comprehensive voting system for collective server operations
WalkthroughsDescription• Implements a complete voting system for collective decision-making on server operations • Core infrastructure includes VoteManager for managing concurrent votes, VoteTypeRegistry for dynamic vote type registration, and Vote class for individual vote instances • VoteSystem provides user-facing functionality: initiate votes, cast votes (yes/no/abstain), view ongoing votes, and query registered vote types • Admin features: delete specific votes, delete all votes, enable/disable voting system, and bypass online requirements • Supports multiple voting modes: direct mode (initiator auto-votes yes) and consult mode (initiator doesn't auto-vote) • Vote eligibility based on online players with bound QQ accounts; admins can override online requirement • Implements vote result checking with automatic pass/reject/timeout detection based on configurable pass percentage • Includes keyword-based vote triggering and voting actions with support for multiple concurrent votes via index selection • Default implementation includes server shutdown voting with configurable timeout and countdown • Comprehensive configuration in default_config.yml with global vote keywords and shutdown vote settings • Full internationalization support with Chinese and English language strings Diagramflowchart LR
User["User/Admin"]
VoteSystem["VoteSystem"]
VoteManager["VoteManager"]
VoteTypeRegistry["VoteTypeRegistry"]
Vote["Vote Instance"]
Callback["Vote Callback"]
User -- "initiate/vote/delete" --> VoteSystem
VoteSystem -- "manage votes" --> VoteManager
VoteSystem -- "register types" --> VoteTypeRegistry
VoteManager -- "create/track" --> Vote
Vote -- "check result" --> Callback
Callback -- "execute action" --> User
File Changes |
Code Review by Qodo
1. QQ号写入日志/聊天
|
添加投票系统,主要用作集体投票决定特定操作的执行,目前完成了投票关闭服务器的操作
单独拆开了投票的功能,为之后可能的拓展留位:
核心功能:管理所有进行中的投票实例
目前默认注册关闭服务器的投票类型,且每种投票类型同一时刻只能出现一条
3. 投票实例 (Vote)
投票状态:PENDING(进行中)、PASSED(通过)、REJECTED(否决)、CANCELLED(取消)、TIMEOUT(超时)、ERROR(错误)
核心功能:
用户功能:
管理员功能:
实际使用:

🔄 投票流程
→ 发起投票
→ 投票过程
等待pr 197完成后会修改相应的函数名