Compare commits

..

2 Commits

Author SHA1 Message Date
a855c69f61 添加「半」钟 2025-09-29 23:25:09 +08:00
90ee296f55 调整UX 2025-09-29 23:22:12 +08:00

View File

@ -25,7 +25,7 @@ PATTERN_DELTA_HMS = re.compile(r"^((\d+|[零一两二三四五六七八九十]+)
PATTERN_DATE_SPECIFY = re.compile(r"(\d{1,2}|[零一二三四五六七八九十]+) ?[日号]")
PATTERN_MONTH_SPECIFY = re.compile(r"(\d{1,2}|[零一二三四五六七八九十]+) ?月")
PATTERN_YEAR_SPECIFY = re.compile(r"(\d|[零一二三四五六七八九十]+) ?年")
PATTERN_HOUR_SPECIFY = re.compile(r"(\d|[零一二三四五六七八九十]+) ?[点时]钟?")
PATTERN_HOUR_SPECIFY = re.compile(r"(\d|[零一二三四五六七八九十]+) ?[点时](半?)钟?")
PATTERN_MINUTE_SPECIFY = re.compile(r"(\d|[零一二三四五六七八九十]+) ?分(钟)?")
PATTERN_SECOND_SPECIFY = re.compile(r"(\d|[零一二三四五六七八九十]+) ?秒(钟)?")
PATTERN_HMS_SPECIFY = re.compile(r"\d\d[:]\d\d([:]\d\d)?")
@ -124,13 +124,15 @@ def get_target_time(content: str) -> datetime.datetime | None:
hour = parse_chinese_or_digit(match4.group(1))
if hour < 0 or hour > 23:
return
t = t.replace(hour=hour)
t = t.replace(hour=hour, minute=0, second=0)
if match4.group(2) != None:
t = t.replace(minute=30)
if match5 := re.match(PATTERN_MINUTE_SPECIFY, content_to_match):
content_to_match = "".join(content_to_match.split(match5.group(0)))
minute = parse_chinese_or_digit(match5.group(1))
if minute < 0 or minute > 59:
return
t = t.replace(minute=minute)
t = t.replace(minute=minute, second=0)
if match6 := re.match(PATTERN_SECOND_SPECIFY, content_to_match):
content_to_match = "".join(content_to_match.split(match6.group(0)))
second = parse_chinese_or_digit(match6.group(1))
@ -241,7 +243,7 @@ async def notify_now(notify: Notify):
await bot.send_group_msg(
group_id=int(notify.target_env),
message=cast(Any,
await UniMessage().at(notify.target).text(f"代办通知:{notify.notify_msg}").export()
await UniMessage().at(notify.target).text(f" 代办通知:{notify.notify_msg}").export()
),
)
else:
@ -322,7 +324,8 @@ async def _(msg: UniMsg, mEvt: Event):
save_notify_config(cfg)
DATA_FILE_LOCK.release()
await evt.send(f"了解啦!将会在 {notify.notify_time} 提醒你哦~")
await evt.send(await UniMessage().at(mEvt.get_user_id()).text(
f" 了解啦!将会在 {notify.notify_time} 提醒你哦~").export())
driver = nonebot.get_driver()