pixiv 定时刷新登录状态

This commit is contained in:
omg-xtao 2023-01-27 12:18:12 +08:00 committed by GitHub
parent a839a15071
commit 803d77b781
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,7 @@ import yaml
from pagermaid import logs
from pagermaid.enums import Client, Message
from pagermaid.listener import listener
from pagermaid.services import scheduler
from pagermaid.utils import pip_install
@ -157,6 +158,15 @@ 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:
return
api = await get_api()
if api:
await api.auth(refresh_token=PluginConfig.refresh_token)
async def send_illust(client: Client, chat_id: int, illust: Illust) -> None:
elements = PluginConfig.message_elements