Refactor project structure and remove obsolete files

- Deleted the Makefile, `README_TESTING.md`, and several deployment scripts to streamline the project.
- Updated `.dockerignore` to exclude unnecessary development files.
- Adjusted database schema comments for clarity.
- Refactored metrics handling in middleware for improved command extraction and logging.
- Enhanced command mappings for buttons and callbacks in constants for better maintainability.
- Start refactor voice bot
This commit is contained in:
2025-09-01 00:54:10 +03:00
parent 2368af3d93
commit d128e54694
25 changed files with 1175 additions and 986 deletions

View File

@@ -343,7 +343,7 @@ async def test_metrics_handler(
await message.answer(
f"✅ Тестовые метрики записаны\n"
f"📊 Активных пользователей: {active_users}\n"
f"🔧 Проверьте Grafana дашборд"
f"🔧 Проверьте Prometheus метрики"
)
except Exception as e:

View File

@@ -0,0 +1,29 @@
"""Constants for admin handlers"""
from typing import Final, Dict
# Admin button texts
ADMIN_BUTTON_TEXTS: Final[Dict[str, str]] = {
"BAN_LIST": "Бан (Список)",
"BAN_BY_USERNAME": "Бан по нику",
"BAN_BY_ID": "Бан по ID",
"UNBAN_LIST": "Разбан (список)",
"RETURN_TO_BOT": "Вернуться в бота",
"CANCEL": "Отменить"
}
# Admin button to command mapping for metrics
ADMIN_BUTTON_COMMAND_MAPPING: Final[Dict[str, str]] = {
"Бан (Список)": "admin_ban_list",
"Бан по нику": "admin_ban_by_username",
"Бан по ID": "admin_ban_by_id",
"Разбан (список)": "admin_unban_list",
"Вернуться в бота": "admin_return_to_bot",
"Отменить": "admin_cancel"
}
# Admin commands
ADMIN_COMMANDS: Final[Dict[str, str]] = {
"ADMIN": "admin",
"TEST_METRICS": "test_metrics"
}

View File

@@ -1,3 +1,5 @@
from typing import Final, Dict
# Callback data constants
CALLBACK_PUBLISH = "publish"
CALLBACK_DECLINE = "decline"
@@ -27,3 +29,13 @@ MESSAGE_USER_BANNED_SPAM = "Ты заблокирован за спам. Дат
# Error messages
ERROR_BOT_BLOCKED = "Forbidden: bot was blocked by the user"
# Callback to command mapping for metrics
CALLBACK_COMMAND_MAPPING: Final[Dict[str, str]] = {
"publish": "publish",
"decline": "decline",
"ban": "ban",
"unlock": "unlock",
"return": "return",
"page": "page"
}

View File

@@ -20,6 +20,16 @@ BUTTON_TEXTS: Final[Dict[str, str]] = {
"CONNECT_ADMIN": "📩Связаться с админами"
}
# Button to command mapping for metrics
BUTTON_COMMAND_MAPPING: Final[Dict[str, str]] = {
"📢Предложить свой пост": "suggest_post",
"👋🏼Сказать пока!": "say_goodbye",
"Выйти из чата": "leave_chat",
"Вернуться в бота": "return_to_bot",
"🤪Хочу стикеры": "want_stickers",
"📩Связаться с админами": "connect_admin"
}
# Error messages
ERROR_MESSAGES: Final[Dict[str, str]] = {
"UNSUPPORTED_CONTENT": (