mirror of
https://github.com/TeamPGM/PagerMaid_Plugins_Pyro.git
synced 2024-11-16 05:45:24 +00:00
pixiv 定时刷新登录状态
This commit is contained in:
parent
a839a15071
commit
803d77b781
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user