PaiGram/plugins/jobs/birthday_card.py

21 lines
684 B
Python
Raw Normal View History

2023-07-23 15:46:11 +00:00
import datetime
from typing import TYPE_CHECKING
from core.plugin import Plugin, job
from plugins.tools.birthday_card import BirthdayCardSystem
from utils.log import logger
if TYPE_CHECKING:
from telegram.ext import ContextTypes
class CardJob(Plugin):
def __init__(self, card_system: BirthdayCardSystem):
self.card_system = card_system
2023-07-24 12:27:49 +00:00
@job.run_daily(time=datetime.time(hour=0, minute=23, second=0), name="CardJob")
2023-07-23 15:46:11 +00:00
async def card(self, context: "ContextTypes.DEFAULT_TYPE"):
logger.info("正在执行自动领取生日画片")
await self.card_system.do_get_card_job(context)
logger.success("执行自动领取生日画片完成")