2022-09-08 01:08:37 +00:00
|
|
|
import datetime
|
|
|
|
|
|
|
|
from telegram.ext import CallbackContext
|
|
|
|
|
|
|
|
from core.plugin import Plugin, job
|
2023-03-14 01:27:22 +00:00
|
|
|
from core.services.cookies.services import PublicCookiesService
|
2022-09-08 01:08:37 +00:00
|
|
|
from utils.log import logger
|
|
|
|
|
2023-03-14 01:27:22 +00:00
|
|
|
__all__ = ("PublicCookiesPlugin",)
|
2022-09-08 01:08:37 +00:00
|
|
|
|
2023-03-14 01:27:22 +00:00
|
|
|
|
|
|
|
class PublicCookiesPlugin(Plugin):
|
2022-09-08 01:08:37 +00:00
|
|
|
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()
|
2022-12-14 15:34:44 +00:00
|
|
|
logger.success("刷新公共Cookies池成功")
|