Skip to content

Commit

Permalink
🐛修复无法重置bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wling-art committed Jan 8, 2024
1 parent d759129 commit d82822e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/plugins/waifu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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:
Expand Down

0 comments on commit d82822e

Please sign in to comment.