更新 zhDateTime 库需求版本

This commit is contained in:
EillesWan 2025-01-31 01:56:07 +08:00
parent 9234e6d392
commit e3684e31d5
3 changed files with 18 additions and 15 deletions

View File

@ -13,7 +13,7 @@ nonebot_plugin_apscheduler>=0.4.0
nonebot-adapter-satori>=0.11.5
# pyppeteer>=2.0.0
markdown>=3.3.6
zhDateTime>=1.1.1
zhDateTime>=2.0.0
numpy<2.0.0
packaging>=23.1
psutil>=5.9.8

View File

@ -7,17 +7,17 @@ def hanzi_timeid(
zhd: Optional[zhDateTime.zhDateTime] = None,
) -> str:
if not zhd:
zhd = zhDateTime.DateTime.now().to_lunar()
zhd = zhDateTime.DateTime.now().chinesize
return "{地支时}{刻}{分}{秒}".format(
地支时=zhDateTime.DÌZHĪ[zhd.shichen]
地支时=zhDateTime.TERRESTRIAL_BRANCHES[zhd.shichen]
+ (
""
if ((zhd.quarters) or (zhd.minutes) or (zhd.seconds) or (zhd.microseconds))
else ""
),
=(
(zhDateTime.HANNUM[zhd.quarters])
(zhDateTime.NUM_IN_HANZI[zhd.quarters])
+ ("" if ((zhd.minutes) or (zhd.seconds) or (zhd.microseconds)) else "")
),
=(
@ -25,8 +25,8 @@ def hanzi_timeid(
+ ("" if ((zhd.seconds) or (zhd.microseconds)) else "")
),
=(
zhDateTime.HANNUM[zhd.seconds // 10]
+ zhDateTime.HANNUM[zhd.seconds % 10]
zhDateTime.NUM_IN_HANZI[zhd.seconds // 10]
+ zhDateTime.NUM_IN_HANZI[zhd.seconds % 10]
+ ("" if (zhd.microseconds) else "")
),
).strip()

View File

@ -115,24 +115,27 @@ async def _():
global yanlun_texts, yanlun_seqs
solar_datetime = zhDateTime.DateTime.now()
lunar_datetime = solar_datetime.to_lunar()
solar_date = (solar_datetime.month, solar_datetime.day)
lunar_date = (lunar_datetime.lunar_month, lunar_datetime.lunar_day)
western_datetime = zhDateTime.DateTime.now()
chinese_datetime = western_datetime.chinesize
western_date = (western_datetime.month, western_datetime.day)
chinese_date = (
chinese_datetime.chinese_calendar_month,
chinese_datetime.chinese_calendar_day,
)
if solar_date == (4, 3):
if western_date == (4, 3):
yanlun_seqs = yanlun_texts = ["金羿ELS 生日快乐~", "Happy Birthday, Eilles!"]
elif solar_date == (8, 6):
elif western_date == (8, 6):
yanlun_seqs = yanlun_texts = [
"玉衡 生日快乐~",
"Happy Birthday, Alioth~!",
]
elif solar_date == (8, 16):
elif western_date == (8, 16):
yanlun_seqs = yanlun_texts = [
"鱼旧梦 生日快乐~",
"Happy Birthday, ElapsingDreams~!",
]
elif lunar_date == (1, 1):
elif chinese_date == (1, 1):
yanlun_seqs = yanlun_texts = [
"新春快乐~",
"千门万户曈曈日,总把新桃换旧符\t——王安石《元日》",
@ -316,5 +319,5 @@ async def _(
):
# ulang = get_user_lang(event_utils.get_user_id(event)) # type: ignore
await time_query.finish(
UniMessage.text(zhDateTime.DateTime.now().to_lunar().hanzify())
UniMessage.text(zhDateTime.DateTime.now().chinesize.chinese_text)
)