iShotaBot/modules/book_of_answers.py

24 lines
605 B
Python
Raw Normal View History

2021-11-28 14:55:10 +00:00
import json
from secrets import choice
from os import sep
from pyrogram import Client, filters, ContinuePropagation
from pyrogram.types import Message
book_of_answers: list[str]
with open(f"resources{sep}text{sep}book_of_answers.json", "r", encoding="utf-8") as file:
book_of_answers = json.load(file)
@Client.on_message(filters.incoming & ~filters.edited &
filters.regex(r"^答案之书$"))
2021-12-08 09:10:31 +00:00
async def book_of_answer(client: Client, message: Message):
2021-11-28 14:55:10 +00:00
await message.reply_text(
f"{choice(book_of_answers)}",
quote=True
)
raise ContinuePropagation