module architecture/ moderator restrictions

This commit is contained in:
Vladless
2025-08-01 01:56:56 +03:00
parent 5fc4ce8930
commit ac258cda37
6 changed files with 40 additions and 16 deletions
+2 -1
View File
@@ -58,4 +58,5 @@ Dockerfile
/logs
setup.py
.ruff_cache
.github/workflows/
.github/workflows/
modules/
+19 -1
View File
@@ -342,6 +342,15 @@ def update_from_beta():
subprocess.run(f"rsync -a {exclude_options} {TEMP_DIR}/ {PROJECT_DIR}/", shell=True)
modules_path = os.path.join(PROJECT_DIR, "modules")
if not os.path.exists(modules_path):
console.print("[yellow]Папка modules отсутствует — создаю вручную...[/yellow]")
try:
os.makedirs(modules_path, exist_ok=True)
console.print("[green]Папка modules успешно создана.[/green]")
except Exception as e:
console.print(f"[red]❌ Не удалось создать папку modules: {e}[/red]")
if os.path.exists(os.path.join(TEMP_DIR, ".git")):
subprocess.run(["cp", "-r", os.path.join(TEMP_DIR, ".git"), PROJECT_DIR])
@@ -411,6 +420,15 @@ def update_from_release():
subprocess.run(f"rsync -a {exclude_options} {TEMP_DIR}/ {PROJECT_DIR}/", shell=True)
modules_path = os.path.join(PROJECT_DIR, "modules")
if not os.path.exists(modules_path):
console.print("[yellow]Папка modules отсутствует — создаю вручную...[/yellow]")
try:
os.makedirs(modules_path, exist_ok=True)
console.print("[green]Папка modules успешно создана.[/green]")
except Exception as e:
console.print(f"[red]❌ Не удалось создать папку modules: {e}[/red]")
if os.path.exists(os.path.join(TEMP_DIR, ".git")):
subprocess.run(["cp", "-r", os.path.join(TEMP_DIR, ".git"), PROJECT_DIR])
@@ -448,7 +466,7 @@ def show_update_menu():
def show_menu():
table = Table(title="Solobot CLI v0.2.9", title_style="bold magenta", header_style="bold blue")
table = Table(title="Solobot CLI v0.3.0", title_style="bold magenta", header_style="bold blue")
table.add_column("", justify="center", style="cyan", no_wrap=True)
table.add_column("Операция", style="white")
table.add_row("1", "Запустить бота (systemd)")
+15 -10
View File
@@ -29,20 +29,20 @@ async def build_panel_kb(admin_role: str) -> InlineKeyboardMarkup:
text="🔑 Поиск по подписке",
callback_data=AdminPanelCallback(action="search_key").pack(),
)
builder.button(
text="🖥️ Управление серверами",
callback_data=AdminPanelCallback(action="clusters").pack(),
)
if admin_role == "superadmin":
builder.button(
text="🖥️ Управление серверами",
callback_data=AdminPanelCallback(action="clusters").pack(),
)
builder.row(
InlineKeyboardButton(text="📢 Рассылка", callback_data=AdminPanelCallback(action="sender").pack()),
InlineKeyboardButton(text="🎟️ Купоны", callback_data=AdminPanelCallback(action="coupons").pack()),
)
builder.row(
InlineKeyboardButton(text="💸 Тарифы", callback_data=AdminPanelCallback(action="tariffs").pack()),
InlineKeyboardButton(text="🎁 Подарки", callback_data=AdminPanelCallback(action="gifts").pack()),
)
if admin_role == "superadmin":
builder.row(
InlineKeyboardButton(text="💸 Тарифы", callback_data=AdminPanelCallback(action="tariffs").pack()),
InlineKeyboardButton(text="🎁 Подарки", callback_data=AdminPanelCallback(action="gifts").pack()),
)
builder.button(
text="🤖 Управление ботом",
callback_data=AdminPanelCallback(action="management").pack(),
@@ -57,6 +57,11 @@ async def build_panel_kb(admin_role: str) -> InlineKeyboardMarkup:
callback_data=AdminPanelCallback(action="ads").pack(),
),
)
else:
builder.button(
text="🎁 Подарки",
callback_data=AdminPanelCallback(action="gifts").pack(),
)
try:
buttons = await run_hooks("admin_panel", admin_role=admin_role)
@@ -70,7 +75,7 @@ async def build_panel_kb(admin_role: str) -> InlineKeyboardMarkup:
text=MAIN_MENU,
callback_data="profile",
)
builder.adjust(1, 1, 1, 2, 2, 1, 2 if admin_role == "superadmin" else 0, 1)
builder.adjust(1, 1, 1, 2, 2, 1, 2 if admin_role == "superadmin" else 1, 1)
return builder.as_markup()
+2 -2
View File
@@ -10,7 +10,7 @@ from aiogram.types import (
)
from aiogram.utils.keyboard import InlineKeyboardBuilder
from config import RUB_TO_XTR
from config import RUB_TO_XTR, STARS_BOT_URL
from handlers.buttons import BACK, MAIN_MENU
from logger import logger
@@ -31,7 +31,7 @@ async def process_donate(callback_query: CallbackQuery, state: FSMContext):
await state.clear()
builder = InlineKeyboardBuilder()
builder.row(InlineKeyboardButton(text="🤖 Бот для покупки звезд", url="https://t.me/PremiumBot"))
builder.row(InlineKeyboardButton(text="🤖 Бот для покупки звезд", url=STARS_BOT_URL))
builder.row(
InlineKeyboardButton(
text="💰 Ввести сумму доната",
+1 -1
View File
@@ -39,7 +39,7 @@ from handlers.texts import (
PLAN_SELECTION_MSG,
get_renewal_message,
)
from handlers.utils import edit_or_send_message, format_days, format_months, get_russian_month
from handlers.utils import edit_or_send_message, get_russian_month
from logger import logger
+1 -1
View File
File diff suppressed because one or more lines are too long