pixiv 修复 refresh_token 函数并更名为 fetch_token (#124)

This commit is contained in:
Ricky8955555 2023-01-27 16:23:04 +08:00 committed by GitHub
parent 47e0fb33ef
commit e5782dca81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -952,7 +952,7 @@
}, },
{ {
"name": "pixiv", "name": "pixiv",
"version": "1.01", "version": "1.02",
"section": "chat", "section": "chat",
"maintainer": "ricky8955555", "maintainer": "ricky8955555",
"size": "7.851 kb", "size": "7.851 kb",

View File

@ -141,7 +141,7 @@ def illust_sensitive_content_filter(
def illust_filter_by_tags(illusts: List[Illust], keywords: str) -> List[Illust]: def illust_filter_by_tags(illusts: List[Illust], keywords: str) -> List[Illust]:
needed = set(keywords.split()) 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: async def get_api() -> AppPixivAPI:
@ -158,13 +158,13 @@ async def get_api() -> AppPixivAPI:
return pixiv_api return pixiv_api
@scheduler.scheduled_job("interval", minutes=30, id="pixiv_refresh_token") @scheduler.scheduled_job("interval", minutes=30, id="pixiv_fetch_token")
async def refresh_token() -> None: async def fetch_token() -> None:
if PluginConfig.refresh_token is None: if not PluginConfig.refresh_token:
return return
api = await get_api() api = await get_api()
if 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: async def send_illust(client: Client, chat_id: int, illust: Illust) -> None: