iShotaBot/modules/book_of_answers.py

25 lines
606 B
Python
Raw Normal View History

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