增设版权声明,更新授权年份,主题色! (#2)

* 优化更新

* 代码不够黑,新增一个空行

* ?

* 空格?

* 新年新气象,莫生气

* 又是空格

* 附和:zhDateTime1.1.1 修复过于愚蠢导致的问题

* 增设版权声明,更新授权年份,主题色!

* ?怎么没删

* 更新 zhDateTime 库版本,主题色往文档里塞

* 我愚蠢了
This commit is contained in:
金羿ELS
2025-01-31 16:11:07 +08:00
committed by GitHub
parent 23ca88b93a
commit 2afe3c48ce
16 changed files with 52 additions and 23 deletions

View File

@ -13,15 +13,17 @@ __marsho_meta__ = PluginMetadata(
)
weekdays = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"]
@on_function_call(description="获取当前时间,日期和星期")
async def get_current_time() -> str:
"""获取当前的时间和日期"""
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}"
time_prompt = "现在的时间是 {}{}{}".format(
current_time.strftime("%Y.%m.%d %H:%M:%S"),
weekdays[current_time.weekday()],
current_time.chinesize.date_hanzify("农历{干支年}{生肖}{月份}{数序日}"),
)
return time_prompt