Skip to content

Comments

Create vote system#200

Open
NancalaStarry wants to merge 13 commits intoPFingan-Code:mainfrom
NancalaStarry:main
Open

Create vote system#200
NancalaStarry wants to merge 13 commits intoPFingan-Code:mainfrom
NancalaStarry:main

Conversation

@NancalaStarry
Copy link

添加投票系统,主要用作集体投票决定特定操作的执行,目前完成了投票关闭服务器的操作
单独拆开了投票的功能,为之后可能的拓展留位:

  1. 投票管理器 (VoteManager)
    核心功能:管理所有进行中的投票实例
  • 创建和管理投票实例
  • 投票进度追踪
  • 自动检查投票结果(通过/否决/超时)
  • 定期清理已结束的投票
  • 支持通过序号或类型查询投票
  1. 投票类型注册器 (VoteTypeRegistry)
  • 动态扩展:允许其他模块注册自定义投票类型
  • 关键词映射:自动管理投票触发关键词
  • 配置管理:统一管理各投票类型的配置参数

目前默认注册关闭服务器的投票类型,且每种投票类型同一时刻只能出现一条
3. 投票实例 (Vote)
投票状态:PENDING(进行中)、PASSED(通过)、REJECTED(否决)、CANCELLED(取消)、TIMEOUT(超时)、ERROR(错误)
核心功能:

  • 支持赞成/反对/弃票操作
  • 实时检查投票结果
  • 自动计算投票进度和剩余时间
  • 支持自定义通过百分比
  1. 投票系统 (VoteSystem)
    用户功能:
  • 发起投票(支持直接模式(发起投票后默认投赞成票)和征求模式(直接发起投票))
  • 投赞成票/反对票/撤回投票
  • 查看所有进行中的投票
  • 查看已注册的投票类型(分页显示)

管理员功能:

  • 删除指定投票
  • 删除所有投票
  • 启用/禁用投票系统
  • 直接发起投票

实际使用:
image
🔄 投票流程

→ 发起投票

  1. 用户发送关键词(如"关服")或命令触发投票
  2. 系统检查:
    • 是否已存在相同类型的进行中投票
    • 发起人是否有投票资格(投票资格为绑定了QQ且在游戏中在线。管理员可绕过在线限制直接发起投票)
    • 是否有足够的合格投票者
  3. 创建投票实例并广播通知
  4. 根据模式决定是否自动投票:
    • 直接模式:发起人自动投赞成票
    • 征求模式:发起人不自动投票

→ 投票过程

  1. 用户发送关键词(如"111"同意,"222"反对)
  2. 系统识别关键词和可选的投票序号
  3. 验证投票资格(基于在线玩家的绑定QQ)
  4. 记录投票(支持改票)
  5. 实时检查投票结果:
    • 达到通过条件 → 立即通过
    • 剩余票数不足以通过 → 立即否决
    • 超时 → 标记为超时
  6. 若投票结束,执行回调函数

等待pr 197完成后会修改相应的函数名

@NancalaStarry NancalaStarry marked this pull request as ready for review February 23, 2026 05:36
@qodo-code-review
Copy link

Review Summary by Qodo

Add comprehensive voting system for collective server operations

✨ Enhancement 📝 Documentation

Grey Divider

Walkthroughs

Description
• 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
Diagram
flowchart 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
Loading

Grey Divider

File Changes

Grey Divider

Qodo Logo

@qodo-code-review
Copy link

qodo-code-review bot commented Feb 23, 2026

Code Review by Qodo

🐞 Bugs (6) 📘 Rule violations (4) 📎 Requirement gaps (0)

Grey Divider


Action required

1. QQ号写入日志/聊天 📘 Rule violation ⛨ Security
Description
新投票系统会在日志与服务器聊天中输出投票者QQ号、资格列表等潜在PII信息,存在隐私泄露风险且不利于合规审计。即使是调试开关控制,也容易在生产环境被误开启而长期暴露数据。
Code

GUGUbot/gugubot/logic/system/vote.py[R995-1003]

+        self.debug_log(f"[VoteSystem Debug] 投票者 {broadcast_info.sender} (sender_id: {broadcast_info.sender_id}) -> QQ: {actual_voter_id}")
+        self.debug_log(f"§e[投票调试] {broadcast_info.sender} 的QQ: {actual_voter_id}", to_server=True)
+
+        # 检查是否有投票资格
+        if actual_voter_id not in vote.eligible_voters:
+            self.debug_log(f"[VoteSystem Debug] QQ {actual_voter_id} 不在投票资格列表中")
+            self.debug_log(f"§c[投票调试] QQ {actual_voter_id} 不在投票资格列表中", to_server=True)
+            self.debug_log(f"§c[投票调试] 资格列表: {vote.eligible_voters}", to_server=True)
+            msg = self.get_tr("not_eligible")
Evidence
合规要求日志不得包含敏感信息(如个人标识符),而本PR新增的调试/日志输出包含QQ号与资格集合(QQ号列表)并且可被输出到游戏服务器聊天。

Rule 5: Generic: Secure Logging Practices
GUGUbot/gugubot/logic/system/vote.py[995-1003]
GUGUbot/gugubot/logic/system/vote.py[1199-1234]
GUGUbot/gugubot/utils/vote_manager.py[576-580]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
投票系统将QQ号、资格列表等潜在PII直接写入日志/服务器聊天(`to_server=True`),违反“日志不应包含敏感信息”的要求。
## Issue Context
当前实现会输出:投票者QQ号、在线玩家绑定QQ列表、资格集合等;这些内容可能被服务器玩家直接看到或被日志长期保留。
## Fix Focus Areas
- GUGUbot/gugubot/logic/system/vote.py[995-1003]
- GUGUbot/gugubot/logic/system/vote.py[1199-1234]
- GUGUbot/gugubot/utils/vote_manager.py[576-580]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. 关服缺少审计上下文 📘 Rule violation ⛨ Security
Description
关服是关键系统动作,但当前仅记录“执行关闭服务器”,未在日志中关联触发的投票ID、发起人/管理员身份与执行结果,难以重建事件链。发生误关服或争议时无法满足审计追踪需求。
Code

GUGUbot/gugubot/logic/system/vote.py[R1342-1372]

+    async def _shutdown_server_callback(self) -> None:
+        """关闭服务器的回调函数"""
+        try:
+            self.logger.info("[VoteSystem] 执行关闭服务器")
+
+            # 当服务器中有其他不存在投票资格的玩家或存在其他投票议程时,赋予额外的准备时间
+            extra_countdown_time = self.config.get_keys(["system", "vote", "shutdown", "extra_countdown"], 0)
+
+            if len(self._get_online_players()) - len(await self._get_eligible_voters()) > 0 \
+                    or len(self.vote_manager.get_all_pending_votes()) - 1 > 0:
+                extra_countdown = extra_countdown_time
+            else:
+                extra_countdown = 0
+
+            # 计算关服最终实际的倒计时时间
+            countdown_total_time = self.config.get_keys(["system", "vote", "shutdown", "countdown"],
+                                                        10) + extra_countdown
+
+            # 发送关闭通知
+            msg = self.get_tr("server_shutting_down",
+                              countdown=countdown_total_time,
+                              extra_countdown_info=self.get_tr(
+                                  "extra_countdown_info") if extra_countdown_time > 0 else "")
+            await self._broadcast_to_all(msg)
+
+            # 等待倒计时结束
+            await asyncio.sleep(countdown_total_time)
+
+            # 执行关闭命令
+            self.server.stop()
+            # self.server.say("[测试] 服务器已收到关闭指令,但不执行(测试模式)")
Evidence
合规要求关键动作应记录用户ID、动作描述与结果;本PR新增关服回调直接执行 server.stop(),但日志缺少触发者与投票上下文,无法形成完整审计链。

Rule 1: Generic: Comprehensive Audit Trails
GUGUbot/gugubot/logic/system/vote.py[1342-1372]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
关服属于关键系统动作,但日志未记录触发该动作的用户/投票上下文(投票ID、发起人ID、结果等),不满足审计追踪要求。
## Issue Context
当前 `VoteSystem._shutdown_server_callback()` 只记录了固定文本并直接 `server.stop()`;回调没有接收 `Vote` 上下文。
## Fix Focus Areas
- GUGUbot/gugubot/logic/system/vote.py[1128-1160]
- GUGUbot/gugubot/logic/system/vote.py[1342-1376]
- GUGUbot/gugubot/utils/vote_manager.py[610-637]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. _handle_vote静默返回📘 Rule violation ⛯ Reliability
Description
当没有进行中的投票时,投票关键词触发会直接返回且不提示用户,属于静默失败。用户体验差且难以排障,违反鲁棒错误处理要求。
Code

GUGUbot/gugubot/logic/system/vote.py[R938-942]

+        # 获取进行中的投票
+        pending_votes = self.vote_manager.get_all_pending_votes()
+        if not pending_votes:
+            return
+
Evidence
合规要求避免静默失败并提供可操作的上下文提示;此处在无投票时直接 return,未回复任何错误/提示信息。

Rule 3: Generic: Robust Error Handling and Edge Case Management
GUGUbot/gugubot/logic/system/vote.py[938-942]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
用户发送投票关键词但当前没有进行中投票时,系统静默返回,未给出任何提示。
## Issue Context
`_handle_vote()` 在 `pending_votes` 为空时直接 `return`。
## Fix Focus Areas
- GUGUbot/gugubot/logic/system/vote.py[938-942]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (5)
4. abstain配置读取错误 📘 Rule violation ⛯ Reliability
Description
配置文件使用 keywords.abstain,但代码读取的是 keywords.withdraw,导致外部配置不会生效并可能引发不可预期的投票行为。该问题属于对外部输入(配置)的不一致处理。
Code

GUGUbot/gugubot/logic/system/vote.py[R82-90]

+    def _load_config(self) -> None:
+        """从配置文件加载投票设置"""
+        # 加载全局投票关键词
+        vote_keywords_config = self.config.get_keys(["system", "vote", "keywords"], {})
+        self.yes_keywords = vote_keywords_config.get("yes", ["111", "同意", "赞成", "yes"])
+        self.no_keywords = vote_keywords_config.get("no", ["222", "反对", "拒绝", "no"])
+        self.withdraw_keywords = vote_keywords_config.get("withdraw", ["弃票", "撤回", "abstain", "withdraw"])
+        self.delete_keywords = vote_keywords_config.get("delete", ["删除投票", "delete_vote"])
+
Evidence
合规要求外部输入(配置)被正确读取与处理;本PR新增默认配置为 abstain,但实现读取 withdraw 键,导致配置项失效。

Rule 6: Generic: Security-First Input Validation and Data Handling
GUGUbot/gugubot/logic/system/vote.py[82-90]
GUGUbot/gugubot/config/defaults/default_config.yml[212-233]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
默认配置使用 `keywords.abstain`,代码却读取 `keywords.withdraw`,导致配置不生效。
## Issue Context
这会让用户误以为配置已生效,但系统仍使用硬编码默认关键词,属于外部输入处理不一致。
## Fix Focus Areas
- GUGUbot/gugubot/logic/system/vote.py[82-90]
- GUGUbot/gugubot/config/defaults/default_config.yml[212-233]
- default_config.yml[211-233]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Invalid f-string quotes🐞 Bug ✓ Correctness
Description
vote.py contains invalid Python f-strings with nested double quotes, which will raise
SyntaxError and prevent the plugin from importing/loading.
Code

GUGUbot/gugubot/logic/system/vote.py[R488-492]

+                yes_votes=progress["yes_votes"],
+                total_voters=progress["total_voters"],
+                current_percentage=f"{progress['current_percentage']:.1f}%",
+                required_percentage=f"{progress["required_percentage"]}%",
+                remaining_time=remaining_time
Evidence
These lines use f"{progress["required_percentage"]}%" which is not valid Python syntax (unescaped
nested quotes). The same bug repeats in other message templates, so the module cannot be imported.

GUGUbot/gugubot/logic/system/vote.py[483-493]
GUGUbot/gugubot/logic/system/vote.py[865-890]
GUGUbot/gugubot/logic/system/vote.py[1172-1182]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`VoteSystem` uses f-strings with nested double quotes (e.g. `f"{progress["required_percentage"]}%"`), which is invalid Python and causes a `SyntaxError` at import time.
### Issue Context
This breaks plugin startup immediately because `VoteSystem` is imported/registered from `gugubot.logic.system`.
### Fix Focus Areas
- GUGUbot/gugubot/logic/system/vote.py[483-493]
- GUGUbot/gugubot/logic/system/vote.py[865-898]
- GUGUbot/gugubot/logic/system/vote.py[1172-1182]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. en_us placeholders wrong🐞 Bug ✓ Correctness
Description
en_us.yml uses {yes_template}/{no_template}/{abstain_template} in user_help_msg, but
VoteSystem provides {yes_example}/{no_example}/{withdraw_example}, risking formatting errors or
user-visible placeholders.
Code

GUGUbot/lang/en_us.yml[R435-438]

+            # Help messages
+            help_msg: "Vote system commands:\n{command_prefix}{name} {enable} -> Enable vote system\n{command_prefix}{name} {disable} -> Disable vote system\n{command_prefix}{name} {list} -> List all active votes\n{command_prefix}{name} {types} -> List available vote types\n{command_prefix}{name} {types} <type_name> -> View vote type details\n{command_prefix}{name} {abstain} [index] -> Withdraw your vote (abstain)\n{command_prefix}{name} {remove} <index> -> Remove vote (admin)\n{command_prefix}{name} {removeAll} -> Remove all votes (admin)\n\nVoting:\n• Send keywords to start vote (e.g. shutdown, restart)\n• Send 1 or yes to vote yes\n• Send 0 or no to vote no\n• Multiple votes: yes 1, no 2\n• You can change your vote\n• Send abstain keywords or use command to withdraw vote\n• Admins can send \"cancel vote\" to force delete entire vote\n\nNote: Only online players with bound QQ can vote"
+            user_help_msg: "Vote system:\n• Send keywords to start vote\n• Send {yes_template} to vote yes\n• Send {no_template} to vote no\n• Multiple votes: {yes_template} 1, {no_template} 2\n• You can change your vote\n• Send {abstain_template} to withdraw your vote\n• Use '{command_prefix}{name} {types}' to view all available vote types\n\nNote: Only online players with bound QQ can vote"
+
Evidence
VoteSystem calls get_tr('user_help_msg', yes_example=..., no_example=..., withdraw_example=...).
The English translation expects different placeholder names. BasicSystem does not catch formatting
errors for server.tr(...), so a strict formatter can raise at runtime or show broken help output.

GUGUbot/lang/en_us.yml[435-438]
GUGUbot/gugubot/logic/system/vote.py[703-756]
GUGUbot/gugubot/logic/system/basic_system.py[177-189]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`en_us.yml` vote help text uses placeholder names that don&amp;#x27;t match what `VoteSystem` passes to `get_tr()`. This can cause formatting failures or visible `{placeholder}` strings.
### Issue Context
`BasicSystem.get_tr()` delegates directly to `server.tr(full_key, **kwargs)` with no KeyError handling.
### Fix Focus Areas
- GUGUbot/lang/en_us.yml[435-438]
- GUGUbot/gugubot/logic/system/vote.py[703-756]
- GUGUbot/gugubot/logic/system/basic_system.py[177-189]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. Vote index collisions🐞 Bug ✓ Correctness
Description
VoteManager assigns vote indices using pending_count + 1, which can reuse an existing index after
earlier votes finish, making voting-by-index ambiguous and potentially targeting the wrong vote.
Code

GUGUbot/gugubot/utils/vote_manager.py[R470-477]

+        # 生成唯一ID
+        self._vote_counter += 1
+        vote_id = f"{vote_type}_{self._vote_counter}_{int(time.time())}"
+
+        # 计算当前投票的索引序号(基于当前进行中的投票数量)
+        pending_count = len(self.get_all_pending_votes())
+        index = pending_count + 1
+
Evidence
After a vote is finalized it is removed from active_votes. If there is a remaining pending vote
with index 2 and a new vote is created, pending_count may again produce index 2, creating two
pending votes with the same index. get_vote_by_index returns the first match, so user input can be
misrouted.

GUGUbot/gugubot/utils/vote_manager.py[470-490]
GUGUbot/gugubot/utils/vote_manager.py[517-533]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Vote indices are derived from `len(pending_votes)+1`, which can collide after votes complete and are removed.
### Issue Context
Users can vote/abstain/remove by index; collisions can route operations to the wrong vote.
### Fix Focus Areas
- GUGUbot/gugubot/utils/vote_manager.py[470-490]
- GUGUbot/gugubot/utils/vote_manager.py[517-533]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. Zero-voter votes hang 🐞 Bug ⛯ Reliability
Description
When eligible_voters is empty, Vote.check_result() returns None and never checks timeout, so
such votes can remain PENDING forever; VoteSystem allows admins to create votes with empty eligible
voters (especially in consult mode).
Code

GUGUbot/gugubot/utils/vote_manager.py[R315-344]

+        if self.status != VoteStatus.PENDING:
+            return self.status
+
+        total_voters = len(self.eligible_voters)
+        if total_voters == 0:
+            return None
+
+        yes_count = len(self.yes_votes)
+        no_count = len(self.no_votes)
+        voted_count = yes_count + no_count
+
+        # 计算当前同意比例
+        current_percentage = yes_count / total_voters if total_voters > 0 else 0.0
+
+        # 检查是否已达到通过条件
+        if current_percentage >= self.required_percentage:
+            self.status = VoteStatus.PASSED
+            return self.status
+
+        # 检查是否不可能通过(剩余票数不足)
+        remaining = total_voters - voted_count
+        max_possible = (yes_count + remaining) / total_voters if total_voters > 0 else 0.0
+        if max_possible < self.required_percentage:
+            self.status = VoteStatus.REJECTED
+            return self.status
+
+        # 检查是否超时
+        if time.time() - self.start_time > self.timeout:
+            self.status = VoteStatus.TIMEOUT
+            return self.status
Evidence
check_result bails out when total_voters==0, preventing TIMEOUT and leaving the vote pending
indefinitely. VoteSystem explicitly allows admins to bypass the non-empty eligible-voter check and
can create votes using the empty set returned from _get_eligible_voters().

GUGUbot/gugubot/utils/vote_manager.py[307-345]
GUGUbot/gugubot/logic/system/vote.py[768-811]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Votes with `eligible_voters == set()` never finalize because `check_result()` returns early and never reaches timeout logic.
### Issue Context
Admins can bypass the &amp;quot;no eligible voters&amp;quot; restriction in `VoteSystem`, so this can happen in real usage.
### Fix Focus Areas
- GUGUbot/gugubot/utils/vote_manager.py[307-345]
- GUGUbot/gugubot/logic/system/vote.py[768-840]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

9. Broadcast leaks to bridge 🐞 Bug ⛯ Reliability
Description
_broadcast_to_all claims it won’t forward to other servers, but it broadcasts to all connectors
with no include/exclude filtering; if minecraft_bridge is enabled, the BridgeConnector will
forward vote messages to other servers (risking duplicate notifications and cross-server confusion).
Code

GUGUbot/gugubot/logic/system/vote.py[R1377-1413]

+    async def _broadcast_to_all(self, message: str) -> None:
+        """向所有连接器广播消息
+
+        这个方法会将投票消息广播到当前 MC 服务器和连接的 QQ 群,
+        但不会转发到其他服务器(避免跨服务器冲突)
+
+        Parameters
+        ----------
+        message : str
+            要广播的消息
+        """
+        try:
+            from gugubot.utils.types import ProcessedInfo, Source
+
+            # 获取当前服务器的标识符
+            server_name = self.config.get_keys(
+                ["connector", "minecraft", "source_name"], "Minecraft"
+            )
+
+            # 构造ProcessedInfo用于广播
+            processed_info = ProcessedInfo(
+                processed_message=[MessageBuilder.text(message)],
+                _source=server_name,
+                source_id=server_name,
+                sender=self.server.tr("gugubot.bot_name"),
+                sender_id=None,
+                raw=message,
+                server=self.server,
+                logger=self.logger,
+                event_sub_type="group",
+                target={}
+            )
+
+            if self.system_manager and self.system_manager.connector_manager:
+                await self.system_manager.connector_manager.broadcast_processed_info(
+                    processed_info
+                )
Evidence
VoteSystem calls broadcast_processed_info() with no connector filtering. ConnectorManager will
send to all connectors by default; BridgeConnector in server mode broadcasts the message to all
connected clients.

GUGUbot/gugubot/logic/system/vote.py[1377-1413]
GUGUbot/gugubot/connector/connector_manager.py[128-166]
GUGUbot/gugubot/connector/bridge_connector.py[289-315]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`VoteSystem._broadcast_to_all()` claims it won&amp;#x27;t forward to other servers, but it broadcasts to all connectors, including `minecraft_bridge` when enabled.
### Issue Context
This can cause vote notifications to be rebroadcast across servers, producing duplicates and confusion.
### Fix Focus Areas
- GUGUbot/gugubot/logic/system/vote.py[1377-1413]
- GUGUbot/gugubot/connector/connector_manager.py[128-176]
- GUGUbot/gugubot/connector/bridge_connector.py[289-315]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Advisory comments

10. zh_cn help formatting🐞 Bug ✓ Correctness
Description
zh_cn.yml wraps the vote.help_msg string across multiple YAML lines inside quotes, introducing
embedded newlines + leading indentation spaces in the rendered help text (user-visible formatting
issue).
Code

GUGUbot/lang/zh_cn.yml[R445-452]

+            # 帮助信息
+            help_msg: "投票系统相关指令:\n{command_prefix}{name} {enable} -> 开启投票系统\n{command_prefix}{name} {disable} -> 
+            关闭投票系统\n{command_prefix}{name} {list} -> 查看所有进行中的投票\n{command_prefix}{name} {types} -> 
+            查看可用的投票类型列表\n{command_prefix}{name} {types} <类型名> -> 查看投票类型详情\n{command_prefix}{name} {remove} <序号> -> 
+            删除指定投票(管理员)\n{command_prefix}{name} {removeAll} -> 删除所有投票(管理员)\n\n投票功能:\n• 
+            发送关键词发起投票(如:{vote_name_example}等)\n• 发送 {yes_example} 投赞成票,发送 {no_example} 投反对票\n• 
+            多个投票进行时需指定序号:{yes_example_single} 1、{no_example_single} 2\n• 重复投票按最后一票为准,发送 {withdraw_example} 撤回已投的票\n• 管理员可发送
+             {delete_example} 强制取消整个投票\n\n注意:正常只有在线且已绑定QQ的玩家有投票资格,管理员可以绕过在线限制发起投票"
Evidence
The string is split across multiple physical lines within a quoted scalar. YAML will preserve the
line breaks/indentation, so the help text will include unexpected whitespace.

GUGUbot/lang/zh_cn.yml[445-452]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`vote.help_msg` in zh_cn is line-wrapped inside a double-quoted YAML scalar, which will embed newlines/leading spaces into the final string.
### Issue Context
This is user-facing (help output) and inconsistent with other translations.
### Fix Focus Areas
- GUGUbot/lang/zh_cn.yml[445-452]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

1. QQ号写入日志/聊天
2. 关服缺少审计上下文
3. _handle_vote静默返回
4. abstain配置读取错误
5. Invalid f-string quotes
6. en_us placeholders wrong
7. Vote index collisions
8. Zero-voter votes hang
9. Broadcast leaks to bridge
10. zh_cn help formatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant