2022-12-17 01:58:33 +02:00
|
|
|
from typing import Union
|
2022-12-05 19:49:51 +02:00
|
|
|
from app import app
|
|
|
|
from pyrogram import filters
|
2022-12-27 14:36:54 +02:00
|
|
|
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, User, Message
|
|
|
|
from pyrogram.client import Client
|
2022-12-05 19:49:51 +02:00
|
|
|
from modules.utils import locale
|
2023-01-03 22:46:16 +02:00
|
|
|
from modules import custom_filters
|
2022-12-17 01:58:33 +02:00
|
|
|
from classes.holo_user import HoloUser
|
|
|
|
|
2023-03-09 17:25:06 +02:00
|
|
|
|
2022-12-17 01:58:33 +02:00
|
|
|
class DefaultRulesMarkup(list):
|
|
|
|
def __init__(self, language_code: Union[str, HoloUser, User, None]):
|
|
|
|
super().__init__([])
|
|
|
|
self.keyboard = InlineKeyboardMarkup(
|
|
|
|
[
|
|
|
|
[
|
2023-03-09 17:25:06 +02:00
|
|
|
InlineKeyboardButton(
|
|
|
|
locale("rules_home", "button", locale=language_code),
|
|
|
|
callback_data="rules_home",
|
|
|
|
),
|
|
|
|
InlineKeyboardButton(
|
|
|
|
locale("rules_additional", "button", locale=language_code),
|
|
|
|
callback_data="rules_additional",
|
|
|
|
),
|
2022-12-17 01:58:33 +02:00
|
|
|
],
|
|
|
|
[
|
|
|
|
InlineKeyboardButton("1", callback_data="rule_1"),
|
|
|
|
InlineKeyboardButton("2", callback_data="rule_2"),
|
2023-03-09 17:25:06 +02:00
|
|
|
InlineKeyboardButton("3", callback_data="rule_3"),
|
2022-12-17 01:58:33 +02:00
|
|
|
],
|
|
|
|
[
|
|
|
|
InlineKeyboardButton("4", callback_data="rule_4"),
|
|
|
|
InlineKeyboardButton("5", callback_data="rule_5"),
|
2023-03-09 17:25:06 +02:00
|
|
|
InlineKeyboardButton("6", callback_data="rule_6"),
|
2022-12-17 01:58:33 +02:00
|
|
|
],
|
|
|
|
[
|
|
|
|
InlineKeyboardButton("7", callback_data="rule_7"),
|
|
|
|
InlineKeyboardButton("8", callback_data="rule_8"),
|
2023-03-09 17:25:06 +02:00
|
|
|
InlineKeyboardButton("9", callback_data="rule_9"),
|
|
|
|
],
|
2022-12-17 01:58:33 +02:00
|
|
|
]
|
|
|
|
)
|
2022-12-05 19:49:51 +02:00
|
|
|
|
|
|
|
|
2023-03-09 17:25:06 +02:00
|
|
|
@app.on_message(
|
|
|
|
custom_filters.enabled_general
|
|
|
|
& ~filters.scheduled
|
|
|
|
& filters.private
|
|
|
|
& ~custom_filters.banned
|
|
|
|
& filters.command(["rules"], prefixes=["/"])
|
|
|
|
)
|
2022-12-27 14:36:54 +02:00
|
|
|
async def cmd_rules(app: Client, msg: Message):
|
2023-03-09 17:25:06 +02:00
|
|
|
await msg.reply_text(
|
|
|
|
locale("rules_msg", locale=msg.from_user),
|
|
|
|
disable_web_page_preview=True,
|
|
|
|
reply_markup=DefaultRulesMarkup(msg.from_user).keyboard,
|
|
|
|
)
|