From d82822ecb23cce5f5b011f24622acb9bba301e83 Mon Sep 17 00:00:00 2001 From: wling Date: Tue, 9 Jan 2024 01:28:40 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=E4=BF=AE=E5=A4=8D=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E9=87=8D=E7=BD=AEbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/waifu/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/waifu/__init__.py b/src/plugins/waifu/__init__.py index a1d9816..b1d1330 100644 --- a/src/plugins/waifu/__init__.py +++ b/src/plugins/waifu/__init__.py @@ -78,7 +78,8 @@ async def reset_record(): logger.info("重置娶群友记录") today = datetime.now() - yesterday = today - timedelta(days=1) + yesterday = datetime(today.year, today.month, today.day, 0, 0, 0) + logger.info(yesterday) await WaifuCP.filter(created_at__lt=yesterday).delete() await Waifu.filter(created_at__lt=yesterday).delete() await WaifuLock.filter(created_at__lt=yesterday).delete() @@ -92,7 +93,8 @@ async def reset_record(): on_command("重置记录", priority=80, block=True, permission=SUPERUSER).append_handler( reset_record ) -scheduler.add_job(reset_record, "cron", hour=0, misfire_grace_time=120) +# 第一个触发时间:每天凌晨 0:00 +scheduler.add_job(reset_record, "cron", hour=0, minute=0, misfire_grace_time=120) async def waifu_rule(bot: Bot, event: GroupMessageEvent, state: T_State) -> bool: