From 224bf15b7276a01445f484456b3cfa93812cc89d Mon Sep 17 00:00:00 2001 From: xtaodada Date: Mon, 21 Aug 2023 10:18:07 +0800 Subject: [PATCH] :bug: Fix bilibili fav audio cache --- defs/bilibili_fav.py | 2 ++ models/services/bilifav.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/defs/bilibili_fav.py b/defs/bilibili_fav.py index f3c5195..856acd2 100644 --- a/defs/bilibili_fav.py +++ b/defs/bilibili_fav.py @@ -110,6 +110,8 @@ async def check_update(m: Message): continue if await BiliFavAction.get_by_bv_id(data.bvid, fav=True): continue + if await BiliFavAction.get_by_id(data.id, fav=True): + continue n = await m.reply(f"处理 {data.type.name} {data.bvid} 中...") try: if data.type == MediaType.video: diff --git a/models/services/bilifav.py b/models/services/bilifav.py index e9b3ef2..8caf9f4 100644 --- a/models/services/bilifav.py +++ b/models/services/bilifav.py @@ -10,6 +10,8 @@ from models.models.bilifav import BiliFav class BiliFavAction: @staticmethod async def get_by_id(id_: int, fav: bool = False) -> Optional[BiliFav]: + if not id_: + return None async with sqlite.session() as session: session = cast(AsyncSession, session) statement = select(BiliFav).where(BiliFav.id == id_)