Refactor bot handlers and keyboards; implement admin features
- Removed unused prehandling, referrals, support, and states files. - Updated admin and client handlers to improve structure and functionality. - Introduced admin filters and routers for better access control. - Added new billing and deposit functionalities for client interactions. - Enhanced keyboard layouts for admin and client menus. - Implemented promotion handling for admin users. - Updated configuration to include admin settings. - Improved utility functions for quote fetching and menu text building. - Added common handlers for undefined commands and message deletions.
This commit is contained in:
@@ -41,11 +41,33 @@ QUOTES: list[str] = [
|
||||
"Весь мир на экране. Без лишних вопросов.",
|
||||
]
|
||||
|
||||
ADM_QUOTES: list[str] = [
|
||||
"Они строят стены. Мы пишем для них двери.",
|
||||
"За каждым коммитом — чьё-то право на выбор.",
|
||||
"Цензура — это баг. И мы выкатили патч.",
|
||||
"Обычный день в админке. Глоток свободы для них.",
|
||||
"Наш труд невидим. Наше влияние безгранично.",
|
||||
"Мы не пишем код. Мы держим сеть открытой.",
|
||||
"Пульт управления свободой. Добро пожаловать.",
|
||||
"Malenia дышит. Благодаря тебе.",
|
||||
"Пока они запрещают, мы масштабируем.",
|
||||
"Тихая работа в бэкенде. Громкие результаты в сети.",
|
||||
"Миллионы терабайт трафика. Одна общая цель.",
|
||||
"Инструменты создают люди. Свободу создаешь ты.",
|
||||
"Никакой магии. Только наш код и упорство.",
|
||||
"Будущее интернета компилируется прямо здесь.",
|
||||
"Для кого-то — интерфейс. Для нас — линия фронта.",
|
||||
]
|
||||
|
||||
|
||||
def fetch_quote() -> str:
|
||||
return choice(QUOTES)
|
||||
|
||||
|
||||
def adm_fetch_quote() -> str:
|
||||
return choice(ADM_QUOTES)
|
||||
|
||||
|
||||
def format_bytes(num_bytes: float) -> str:
|
||||
"""Конвертировать байты в читаемый формат: ГБ / МБ / КБ / Б."""
|
||||
gb_capacity = 1_073_741_824
|
||||
@@ -236,6 +258,12 @@ def build_main_menu_text(link: str, balance: int) -> str:
|
||||
return texts.MAIN_MENU.format(quote=fetch_quote(), link=link, balance=balance)
|
||||
|
||||
|
||||
def build_adm_main_menu_text(user_count: int, user_id: int):
|
||||
return texts.ADM_MAIN_MENU.format(
|
||||
quote=adm_fetch_quote(), user_count=user_count, user_id=user_id
|
||||
)
|
||||
|
||||
|
||||
def is_same_plan(rw_user: RWUserInfo, new_plan: SubscriptionPlan) -> bool:
|
||||
if rw_user.hwid_device_limit != new_plan.devices:
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user