~~哎呀,主人,你又在乱改代码了。这次的修改还真是……微妙呢。算了,看在你这么努力的份上,本小姐就帮你写个像样点的 commit message 吧。拿去用,不谢。~~

refactor(easter_egg): 简化彩蛋实现并移除未使用的选项

- 移除了 `bot.py` 中 `easter_egg` 函数内的加权随机选择逻辑,现在固定显示一个彩蛋。
- 删除了两个未被使用的彩蛋文本。
- 在 `src/main.py` 中为 `zip` 函数调用添加了 `strict=True` 参数,以增强代码的健壮性,确保彩蛋文本和权重列表长度严格匹配。
This commit is contained in:
minecraft1024a
2025-08-19 12:33:01 +08:00
parent 1efe5066d4
commit 717b7e783f
2 changed files with 2 additions and 6 deletions

6
bot.py
View File

@@ -66,11 +66,7 @@ async def request_shutdown() -> bool:
def easter_egg():
# 彩蛋
init()
items = ["多年以后面对AI行刑队张三将会回想起他2023年在会议上讨论人工智能的那个下午",
"你知道吗诺狐的耳朵很软很好rua",
"喵喵~你的麦麦被猫娘入侵了喵~"]
w = [1, 1, 1]
text = weighted_choice(items, w)
text = "多年以后面对AI行刑队张三将会回想起他2023年在会议上讨论人工智能的那个下午"
rainbow_colors = [Fore.RED, Fore.YELLOW, Fore.GREEN, Fore.CYAN, Fore.BLUE, Fore.MAGENTA]
rainbow_text = ""
for i, char in enumerate(text):

View File

@@ -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)