{% for show in shows %}
-
+
{{ show.name }}
@@ -186,11 +221,17 @@
{% endfor %}
+
\ No newline at end of file
diff --git a/nonebot_plugin_acgnshow/util.py b/nonebot_plugin_acgnshow/util.py
index 51b5ad5..f48b85c 100644
--- a/nonebot_plugin_acgnshow/util.py
+++ b/nonebot_plugin_acgnshow/util.py
@@ -1,15 +1,21 @@
-from .config import BGIMAGE_PATH
+import os
import random
import datetime
+from .config import BGIMAGE_PATH
-def choose_random_bgimage():
- randomfile = random.choice(list(BGIMAGE_PATH.iterdir()))
- randomurl = randomfile.as_uri()
+
+def choose_random_bgimage() -> str:
+ """
+ 从背景图片文件夹中随机选择一张图片,返回图片的uri地址
+ """
+ randomfile = random.choice(os.listdir(BGIMAGE_PATH))
+ randomurl = (BGIMAGE_PATH / randomfile).as_uri()
return randomurl
-def convert_timestamp(timestamp):
- obj = datetime.datetime.fromtimestamp(timestamp)
- formatted_time = obj.strftime('%Y-%m-%d %H:%M:%S')
- return formatted_time
+def convert_timestamp(timestamp) -> str:
+ """
+ 将时间戳转换为日期格式
+ """
+ return datetime.datetime.fromtimestamp(timestamp).strftime("%Y-%m-%d %H:%M:%S")
diff --git a/pyproject.toml b/pyproject.toml
index f091246..5d6b808 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,9 +4,7 @@ version = "0.1.5"
description = "Nonebot2插件,从哔哩哔哩会员购获取简易展览数据"
readme = "README.md"
requires-python = "<4.0,>=3.9"
-authors = [
- { name = "Asankilp", email = "asankilp@outlook.com" },
-]
+authors = [{ name = "Asankilp", email = "asankilp@outlook.com" }]
dependencies = [
"nonebot2[fastapi, websockets]>=2.2.0",
"nonebot-plugin-alconna>=0.48.0",