mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-25 01:29:42 +00:00
233e7ab58d
Co-authored-by: luoshuijs <luoshuijs@outlook.com> Co-authored-by: Karako <karakohear@gmail.com> Co-authored-by: xtaodada <xtao@xtaolink.cn>
21 lines
698 B
Python
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池成功")
|