mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-29 11:03:16 +00:00
🎨 quiz
插件对私聊信息不执行自动删除
This commit is contained in:
parent
4660b34db4
commit
5673635441
@ -8,6 +8,7 @@ from core.admin import BotAdminService
|
||||
from core.baseplugin import BasePlugin
|
||||
from core.plugin import Plugin, handler
|
||||
from core.quiz import QuizService
|
||||
from utils.decorators.error import error_callable
|
||||
from utils.decorators.restricts import restricts
|
||||
from utils.log import logger
|
||||
from utils.random import MT19937Random
|
||||
@ -24,13 +25,14 @@ class QuizPlugin(Plugin, BasePlugin):
|
||||
|
||||
@handler(CommandHandler, command="quiz", block=False)
|
||||
@restricts(restricts_time_of_groups=20)
|
||||
@error_callable
|
||||
async def command_start(self, update: Update, context: CallbackContext) -> None:
|
||||
user = update.effective_user
|
||||
message = update.effective_message
|
||||
chat = message.chat
|
||||
await message.reply_chat_action(ChatAction.TYPING)
|
||||
question_id_list = await self.quiz_service.get_question_id_list()
|
||||
if filters.ChatType.GROUPS.filter(update.message):
|
||||
if filters.ChatType.GROUPS.filter(message):
|
||||
logger.info(f"用户 {user.full_name}[{user.id}] 在群 {chat.title}[{chat.id}] 发送挑战问题命令请求")
|
||||
if len(question_id_list) == 0:
|
||||
return None
|
||||
@ -58,5 +60,6 @@ class QuizPlugin(Plugin, BasePlugin):
|
||||
open_period=self.time_out,
|
||||
type=Poll.QUIZ,
|
||||
)
|
||||
if filters.ChatType.GROUPS.filter(message):
|
||||
self._add_delete_message_job(context, update.message.chat_id, update.message.message_id, 300)
|
||||
self._add_delete_message_job(context, poll_message.chat_id, poll_message.message_id, 300)
|
||||
|
Loading…
Reference in New Issue
Block a user