mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-acgnshow.git
synced 2024-11-11 01:27:39 +08:00
⚡ 在请求中使用异步代替同步防止进程阻塞,优化部分代码样式
This commit is contained in:
parent
fc5931bf33
commit
e82edfcae6
@ -1,10 +1,14 @@
|
||||
from .config import BGIMAGE_PATH
|
||||
import random
|
||||
import datetime
|
||||
|
||||
|
||||
def choose_random_bgimage():
|
||||
randomfile = random.choice(list(BGIMAGE_PATH.iterdir()))
|
||||
randomurl = randomfile.as_uri()
|
||||
return randomurl
|
||||
|
||||
|
||||
def convert_timestamp(timestamp):
|
||||
obj = datetime.datetime.fromtimestamp(timestamp)
|
||||
formatted_time = obj.strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
Loading…
Reference in New Issue
Block a user