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