From e5782dca81e59cc702602a969e56d3ffc89db447 Mon Sep 17 00:00:00 2001 From: Ricky8955555 Date: Fri, 27 Jan 2023 16:23:04 +0800 Subject: [PATCH] =?UTF-8?q?pixiv=20=E4=BF=AE=E5=A4=8D=20`refresh=5Ftoken`?= =?UTF-8?q?=20=E5=87=BD=E6=95=B0=E5=B9=B6=E6=9B=B4=E5=90=8D=E4=B8=BA=20`fe?= =?UTF-8?q?tch=5Ftoken`=20(#124)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- list.json | 2 +- pixiv/main.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/list.json b/list.json index af34c78..d8c036b 100644 --- a/list.json +++ b/list.json @@ -952,7 +952,7 @@ }, { "name": "pixiv", - "version": "1.01", + "version": "1.02", "section": "chat", "maintainer": "ricky8955555", "size": "7.851 kb", diff --git a/pixiv/main.py b/pixiv/main.py index 69241ff..55a2e51 100644 --- a/pixiv/main.py +++ b/pixiv/main.py @@ -141,7 +141,7 @@ def illust_sensitive_content_filter( def illust_filter_by_tags(illusts: List[Illust], keywords: str) -> List[Illust]: needed = set(keywords.split()) - return [illust for illust in illusts if needed.intersection(illust.tags) or True] + return [illust for illust in illusts if (needed.intersection(illust.tags) if needed else True)] async def get_api() -> AppPixivAPI: @@ -158,13 +158,13 @@ async def get_api() -> AppPixivAPI: return pixiv_api -@scheduler.scheduled_job("interval", minutes=30, id="pixiv_refresh_token") -async def refresh_token() -> None: - if PluginConfig.refresh_token is None: +@scheduler.scheduled_job("interval", minutes=30, id="pixiv_fetch_token") +async def fetch_token() -> None: + if not PluginConfig.refresh_token: return api = await get_api() if api: - await api.auth(refresh_token=PluginConfig.refresh_token) + await api.login(refresh_token=PluginConfig.refresh_token) async def send_illust(client: Client, chat_id: int, illust: Illust) -> None: