mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-25 18:04:10 +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.baseplugin import BasePlugin
|
||||||
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.error import error_callable
|
||||||
from utils.decorators.restricts import restricts
|
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
|
||||||
@ -24,13 +25,14 @@ class QuizPlugin(Plugin, BasePlugin):
|
|||||||
|
|
||||||
@handler(CommandHandler, command="quiz", block=False)
|
@handler(CommandHandler, command="quiz", block=False)
|
||||||
@restricts(restricts_time_of_groups=20)
|
@restricts(restricts_time_of_groups=20)
|
||||||
|
@error_callable
|
||||||
async def command_start(self, update: Update, context: CallbackContext) -> None:
|
async def command_start(self, update: Update, context: CallbackContext) -> None:
|
||||||
user = update.effective_user
|
user = update.effective_user
|
||||||
message = update.effective_message
|
message = update.effective_message
|
||||||
chat = message.chat
|
chat = message.chat
|
||||||
await message.reply_chat_action(ChatAction.TYPING)
|
await message.reply_chat_action(ChatAction.TYPING)
|
||||||
question_id_list = await self.quiz_service.get_question_id_list()
|
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}] 发送挑战问题命令请求")
|
logger.info(f"用户 {user.full_name}[{user.id}] 在群 {chat.title}[{chat.id}] 发送挑战问题命令请求")
|
||||||
if len(question_id_list) == 0:
|
if len(question_id_list) == 0:
|
||||||
return None
|
return None
|
||||||
@ -58,5 +60,6 @@ class QuizPlugin(Plugin, BasePlugin):
|
|||||||
open_period=self.time_out,
|
open_period=self.time_out,
|
||||||
type=Poll.QUIZ,
|
type=Poll.QUIZ,
|
||||||
)
|
)
|
||||||
self._add_delete_message_job(context, update.message.chat_id, update.message.message_id, 300)
|
if filters.ChatType.GROUPS.filter(message):
|
||||||
self._add_delete_message_job(context, poll_message.chat_id, poll_message.message_id, 300)
|
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