mirror of
https://github.com/TeamPGM/PagerMaid_Plugins_Pyro.git
synced 2024-11-24 23:54:06 +00:00
pixiv 修复 refresh_token
函数并更名为 fetch_token
(#124)
This commit is contained in:
parent
47e0fb33ef
commit
e5782dca81
@ -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",
|
||||||
|
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user