mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-acgnshow.git
synced 2025-09-06 12:16:25 +00:00
格式化代码,细节优化,修复了图片边框不完整的问题
This commit is contained in:
@ -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")
|
||||
|
Reference in New Issue
Block a user