This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
Telegram/modules/commands/rules.py
2023-01-03 21:46:16 +01:00

42 lines
2.1 KiB
Python

from typing import Union
from app import app
from pyrogram import filters
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, User, Message
from pyrogram.client import Client
from modules.utils import locale
from modules import custom_filters
from classes.holo_user import HoloUser
class DefaultRulesMarkup(list):
def __init__(self, language_code: Union[str, HoloUser, User, None]):
super().__init__([])
self.keyboard = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(locale("rules_home", "button", locale=language_code), callback_data="rules_home"),
InlineKeyboardButton(locale("rules_additional", "button", locale=language_code), callback_data="rules_additional")
],
[
InlineKeyboardButton("1", callback_data="rule_1"),
InlineKeyboardButton("2", callback_data="rule_2"),
InlineKeyboardButton("3", callback_data="rule_3")
],
[
InlineKeyboardButton("4", callback_data="rule_4"),
InlineKeyboardButton("5", callback_data="rule_5"),
InlineKeyboardButton("6", callback_data="rule_6")
],
[
InlineKeyboardButton("7", callback_data="rule_7"),
InlineKeyboardButton("8", callback_data="rule_8"),
InlineKeyboardButton("9", callback_data="rule_9")
]
]
)
# Rules command =============================================================================================================
@app.on_message(custom_filters.enabled_general & ~filters.scheduled & filters.private & filters.command(["rules"], prefixes=["/"]))
async def cmd_rules(app: Client, msg: Message):
await msg.reply_text(locale("rules_msg", locale=msg.from_user), disable_web_page_preview=True, reply_markup=DefaultRulesMarkup(msg.from_user).keyboard)
# ==============================================================================================================================