🎨 给群验证模块添加 @restricts 修饰器

This commit is contained in:
洛水居室 2022-09-11 00:39:32 +08:00
parent bf4b72cb9e
commit 8db608c156
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -12,6 +12,7 @@ from telegram.helpers import escape_markdown
from core.bot import bot from core.bot import bot
from core.plugin import Plugin, handler from core.plugin import Plugin, handler
from core.quiz import QuizService from core.quiz import QuizService
from utils.decorators.restricts import restricts
from utils.log import logger from utils.log import logger
from utils.random import MT19937Random from utils.random import MT19937Random
@ -101,6 +102,7 @@ class GroupJoiningVerification(Plugin):
logger.exception(exc) logger.exception(exc)
@handler(CallbackQueryHandler, pattern=r"^auth_admin\|", block=False) @handler(CallbackQueryHandler, pattern=r"^auth_admin\|", block=False)
@restricts(without_overlapping=True)
async def admin(self, update: Update, context: CallbackContext) -> None: async def admin(self, update: Update, context: CallbackContext) -> None:
async def admin_callback(callback_query_data: str) -> Tuple[str, int]: async def admin_callback(callback_query_data: str) -> Tuple[str, int]:
@ -159,6 +161,7 @@ class GroupJoiningVerification(Plugin):
schedule.remove() schedule.remove()
@handler(CallbackQueryHandler, pattern=r"^auth_challenge\|", block=False) @handler(CallbackQueryHandler, pattern=r"^auth_challenge\|", block=False)
@restricts(without_overlapping=True)
async def query(self, update: Update, context: CallbackContext) -> None: async def query(self, update: Update, context: CallbackContext) -> None:
async def query_callback(callback_query_data: str) -> Tuple[int, bool, str, str]: async def query_callback(callback_query_data: str) -> Tuple[int, bool, str, str]: