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:
@@ -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:
|
||||
|
||||
29
helper_bot/handlers/admin/constants.py
Normal file
29
helper_bot/handlers/admin/constants.py
Normal 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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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": (
|
||||
|
||||
Reference in New Issue
Block a user