mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-08-02 14:49:51 +00:00
@ -2,6 +2,9 @@ import os
|
||||
|
||||
from zhDateTime import DateTime
|
||||
|
||||
weekdays = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"]
|
||||
time_prompt = "现在的时间是{date_time},{weekday_name},农历{lunar_date}。"
|
||||
|
||||
|
||||
async def get_weather(location: str):
|
||||
return f"{location}的温度是114514℃。"
|
||||
@ -13,12 +16,12 @@ async def get_current_env():
|
||||
|
||||
|
||||
async def get_current_time():
|
||||
current_time = DateTime.now().strftime("%Y.%m.%d %H:%M:%S")
|
||||
current_weekday = DateTime.now().weekday()
|
||||
current_time = DateTime.now()
|
||||
|
||||
weekdays = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"]
|
||||
current_weekday_name = weekdays[current_weekday]
|
||||
|
||||
current_lunar_date = DateTime.now().to_lunar().date_hanzify()[5:]
|
||||
time_prompt = f"现在的时间是{current_time},{current_weekday_name},农历{current_lunar_date}。"
|
||||
return time_prompt
|
||||
return time_prompt.format(
|
||||
date_time=current_time.strftime("%Y年%m月%d日 %H:%M:%S"),
|
||||
weekday_name=weekdays[current_time.weekday()],
|
||||
lunar_date=current_time.to_lunar().date_hanzify(
|
||||
"{干支年}{生肖}年{月份}月{日期}日"
|
||||
),
|
||||
)
|
||||
|
Reference in New Issue
Block a user