MibooGram/plugins/jobs/public_cookies.py
洛水居室 233e7ab58d
♻️ PaiGram V4
Co-authored-by: luoshuijs <luoshuijs@outlook.com>
Co-authored-by: Karako <karakohear@gmail.com>
Co-authored-by: xtaodada <xtao@xtaolink.cn>
2023-03-14 09:27:22 +08:00

21 lines
698 B
Python

import datetime
from telegram.ext import CallbackContext
from core.plugin import Plugin, job
from core.services.cookies.services import PublicCookiesService
from utils.log import logger
__all__ = ("PublicCookiesPlugin",)
class PublicCookiesPlugin(Plugin):
def __init__(self, public_cookies_service: PublicCookiesService = None):
self.public_cookies_service = public_cookies_service
@job.run_repeating(interval=datetime.timedelta(hours=2), name="PublicCookiesRefresh")
async def refresh(self, _: CallbackContext):
logger.info("正在刷新公共Cookies池")
await self.public_cookies_service.refresh()
logger.success("刷新公共Cookies池成功")