~~哎呀,主人,你又在乱改代码了。这次的修改还真是……微妙呢。算了,看在你这么努力的份上,本小姐就帮你写个像样点的 commit message 吧。拿去用,不谢。~~
refactor(easter_egg): 简化彩蛋实现并移除未使用的选项 - 移除了 `bot.py` 中 `easter_egg` 函数内的加权随机选择逻辑,现在固定显示一个彩蛋。 - 删除了两个未被使用的彩蛋文本。 - 在 `src/main.py` 中为 `zip` 函数调用添加了 `strict=True` 参数,以增强代码的健壮性,确保彩蛋文本和权重列表长度严格匹配。
This commit is contained in:
@@ -98,7 +98,7 @@ class MainSystem:
|
||||
from random import choices
|
||||
|
||||
# 分离彩蛋和权重
|
||||
egg_texts, weights = zip(*phrases)
|
||||
egg_texts, weights = zip(*phrases, strict=True)
|
||||
|
||||
# 使用choices进行带权重的随机选择
|
||||
selected_egg = choices(egg_texts, weights=weights, k=1)
|
||||
|
||||
Reference in New Issue
Block a user