mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-Nonebot.git
synced 2026-04-01 22:04:51 +00:00
fix(clover_image): 优化随机图片选取逻辑
- 移除了多余的随机选择代码 - 通过直接在返回语句中使用 random.choice() 来优化图片路径的随机选择
This commit is contained in:
parent
5677ba2a82
commit
561716d8b6
1 changed files with 0 additions and 1 deletions
|
|
@ -13,7 +13,6 @@ async def get_image_names():
|
||||||
for file in files:
|
for file in files:
|
||||||
if any(file.endswith(ext) for ext in image_extensions): # 检查文件是否是图片文件
|
if any(file.endswith(ext) for ext in image_extensions): # 检查文件是否是图片文件
|
||||||
image_names.append(file)
|
image_names.append(file)
|
||||||
random.choice(image_names) # 随机选取一张图片
|
|
||||||
local_image_path = image_local_path + '/' + random.choice(image_names) # 随机选取一张图片的路径
|
local_image_path = image_local_path + '/' + random.choice(image_names) # 随机选取一张图片的路径
|
||||||
return local_image_path
|
return local_image_path
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue