2024-11-23 21:21:19 +08:00
|
|
|
|
import os
|
2024-12-13 02:23:38 +08:00
|
|
|
|
|
2024-11-23 21:21:19 +08:00
|
|
|
|
from zhDateTime import DateTime
|
2024-11-30 03:40:10 +08:00
|
|
|
|
|
2025-01-29 00:36:53 +08:00
|
|
|
|
weekdays = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"]
|
|
|
|
|
time_prompt = "现在的时间是{date_time},{weekday_name},农历{lunar_date}。"
|
|
|
|
|
|
2024-11-30 03:40:10 +08:00
|
|
|
|
|
2024-11-23 21:21:19 +08:00
|
|
|
|
async def get_weather(location: str):
|
|
|
|
|
return f"{location}的温度是114514℃。"
|
2024-11-30 03:40:10 +08:00
|
|
|
|
|
|
|
|
|
|
2024-11-23 21:21:19 +08:00
|
|
|
|
async def get_current_env():
|
|
|
|
|
ver = os.popen("uname -a").read()
|
|
|
|
|
return str(ver)
|
|
|
|
|
|
2024-11-30 03:40:10 +08:00
|
|
|
|
|
2024-11-23 21:21:19 +08:00
|
|
|
|
async def get_current_time():
|
2025-01-29 00:36:53 +08:00
|
|
|
|
current_time = DateTime.now()
|
|
|
|
|
|
|
|
|
|
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(
|
|
|
|
|
"{干支年}{生肖}年{月份}月{日期}日"
|
|
|
|
|
),
|
|
|
|
|
)
|