mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-22 22:37:21 +00:00
8f424bf0d4
♻️ 重构插件系统 ⚙️ 重写插件 🎨 改进代码结构 📝 完善文档 Co-authored-by: zhxy-CN <admin@owo.cab> Co-authored-by: 洛水居室 <luoshuijs@outlook.com> Co-authored-by: xtaodada <xtao@xtaolink.cn> Co-authored-by: Li Chuangbo <im@chuangbo.li>
20 lines
645 B
Python
20 lines
645 B
Python
import datetime
|
|
|
|
from telegram.ext import CallbackContext
|
|
|
|
from core.cookies.services import PublicCookiesService
|
|
from core.plugin import Plugin, job
|
|
from utils.log import logger
|
|
|
|
|
|
class PublicCookies(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.info("刷新公共Cookies池成功")
|