Commit Graph

30 Commits

Author SHA1 Message Date
bba5550e15 Обновлены тесты для сервиса аудиофайлов и ограничения скорости, добавлено патчирование asyncio.sleep для проверки задержек. Исправлены комментарии и улучшена читаемость тестов. 2026-02-01 22:43:36 +03:00
d2d7c83575 Обновлен Python до версии 3.11.9 и изменены зависимости в Dockerfile и pyproject.toml. Удалены устаревшие файлы RATE_LIMITING_SOLUTION.md и тесты для rate limiting.
Обновлены пути к библиотекам в Dockerfile для соответствия новой версии Python.
Исправлены все тесты, теперь все проходят
2026-01-25 16:07:27 +03:00
3b841fcbfa Добавлен функционал для отслеживания истории банов пользователей.
- Введена новая модель `BlacklistHistoryRecord` для хранения информации о банах и разблокировках.
- Обновлены методы `set_user_blacklist` и `delete_user_blacklist` в `AsyncBotDB` для логирования событий в историю.
- Обновлена схема базы данных для создания таблицы `blacklist_history` и соответствующих индексов.
- Обновлены тесты для проверки нового функционала и обработки ошибок при записи в историю.
2026-01-23 16:23:27 +03:00
477e2666a3 Добавлено поле ban_author в модель BlacklistUser и соответствующие изменения в базе данных для отслеживания автора блокировки пользователя. Обновлены методы работы с черным списком в AsyncBotDB и BlacklistRepository, а также обработка блокировок в AdminService и BanService. Обновлены тесты для проверки новых функциональностей. 2026-01-23 13:38:48 +03:00
89022aedaf Реализован функцоинал хранения сырых текстов поста в базе данных. Оформление поста происходит непосредственно перед его отправкой в канал.
- Реализованы методы `get_post_text_and_anonymity_by_message_id` и `get_post_text_and_anonymity_by_helper_id` в `PostRepository` для получения текста поста и флага анонимности.
- Обновлена модель `TelegramPost`, добавлено поле `is_anonymous`.
- Изменена схема базы данных для включения поля `is_anonymous` в таблицу `post_from_telegram_suggest`.
- Обновлены функции публикации постов в `PostPublishService` для учета анонимности.
- Добавлены тесты для проверки новых функций и корректности работы с анонимностью.
2026-01-23 12:12:21 +03:00
03ed2bcf4e Обновлена ​​обработка статуса медиагрупп и улучшены интеграционные тесты
- Реализовано обновление статуса медиагрупп в `PostPublishService` при отклонении медиагрупп.

- Добавлены интеграционные тесты для обновления статусов постов и медиагрупп в `test_post_repository_integration.py

- Улучшен фиктивный репозиторий в `conftest_post_repository.py` для поддержки новых методов обновления статуса.

- Обновлены существующие тесты для проверки корректной обработки статуса постов и медиагрупп.
2026-01-22 23:52:48 +03:00
31e29cdec0 Update banned users handling with async support and improved date parsing
- Modified `change_page` function in `callback_handlers.py` to use async methods for retrieving banned users and their buttons.
- Enhanced `get_banned_users_list` in `helper_func.py` to handle string timestamps and various date formats, ensuring robust date parsing.
- Added a new test case in `test_utils.py` to validate the handling of string timestamps in the banned users list retrieval.
2025-09-08 23:19:19 +03:00
5f6882d348 Implement audio record management features in AsyncBotDB and AudioRepository
- Added methods to delete audio moderation records and retrieve all audio records in async_db.py.
- Enhanced AudioRepository with functionality to delete audio records by file name and retrieve all audio message records.
- Improved logging for audio record operations to enhance monitoring and debugging capabilities.
- Updated related handlers to ensure proper integration of new audio management features.
2025-09-05 01:31:50 +03:00
fc0517c011 Enhance bot functionality with new features and improvements
- Added a new `/status` endpoint in `server_prometheus.py` to provide process status information, including uptime and resource usage metrics.
- Implemented a PID manager in `run_helper.py` to track the bot's process, improving monitoring capabilities.
- Introduced a method to delete audio moderation records in `audio_repository.py`, enhancing database management.
- Updated voice message handling in callback handlers to ensure proper deletion of audio moderation records.
- Improved error handling and logging in various services, ensuring better tracking of media processing and file downloads.
- Refactored media handling functions to streamline operations and improve code readability.
- Enhanced metrics tracking for file downloads and media processing, providing better insights into bot performance.
2025-09-04 00:46:45 +03:00
c8c7d50cbb Refactor metrics handling and improve logging
- Removed the MetricsManager initialization from `run_helper.py` to avoid duplication, as metrics are now handled in `main.py`.
- Updated logging levels in `server_prometheus.py` and `metrics_middleware.py` to use debug instead of info for less critical messages.
- Added metrics configuration to `BaseDependencyFactory` for better management of metrics settings.
- Deleted the obsolete `metrics_exporter.py` file to streamline the codebase.
- Updated various tests to reflect changes in the metrics handling and ensure proper functionality.
2025-09-03 00:33:20 +03:00
1ab427a7ba Enhance admin handlers with improved logging and error handling
- Added detailed logging for user ban processing in `process_ban_target` and `process_ban_reason` functions, including user data and error messages.
- Improved error handling for user input validation and database interactions.
- Updated `return_to_admin_menu` function to log user return actions.
- Enhanced media group handling in `PostPublishService` with better error logging and author ID retrieval.
- Added new button options in voice handlers and updated keyboard layouts for improved user interaction.
- Refactored album middleware to better handle media group messages and added documentation for clarity.
2025-09-02 22:20:34 +03:00
1c6a37bc12 Enhance bot functionality and refactor database interactions
- Added `ca-certificates` installation to Dockerfile for improved network security.
- Updated health check command in Dockerfile to include better timeout handling.
- Refactored `run_helper.py` to implement proper signal handling and logging during shutdown.
- Transitioned database operations to an asynchronous model in `async_db.py`, improving performance and responsiveness.
- Updated database schema to support new foreign key relationships and optimized indexing for better query performance.
- Enhanced various bot handlers to utilize async database methods, improving overall efficiency and user experience.
- Removed obsolete database and fix scripts to streamline the project structure.
2025-09-02 18:22:02 +03:00
013892dcb7 Remove obsolete configuration management and test settings files
- Deleted the `config.py` file responsible for managing bot configuration via environment variables and `.env` files, as it is no longer needed.
- Removed the `test_settings.ini` file used for testing, which contained mock configuration data.
- Cleaned up the project structure by eliminating unused files to enhance maintainability.
2025-09-01 20:30:10 +03:00
2d40f4496e Update voice bot functionality and clean up project structure
- Added voice message handling capabilities, including saving and deleting audio messages via callback queries.
- Refactored audio record management in the database to remove unnecessary fields and streamline operations.
- Introduced new keyboard options for voice interactions in the bot.
- Updated `.gitignore` to include voice user files for better project organization.
- Removed obsolete voice bot handler files to simplify the codebase.
2025-09-01 19:17:05 +03:00
98d12be67d Initial commit for dev-8 branch with all current changes 2025-08-31 15:35:42 +03:00
8f338196b7 Refactor Docker and configuration files for improved structure and functionality
- Updated `.dockerignore` to include additional development and temporary files, enhancing build efficiency.
- Modified `.gitignore` to remove unnecessary entries and streamline ignored files.
- Enhanced `docker-compose.yml` with health checks, resource limits, and improved environment variable handling for better service management.
- Refactored `Dockerfile.bot` to utilize a multi-stage build for optimized image size and security.
- Improved `Makefile` with new commands for deployment, migration, and backup, along with enhanced help documentation.
- Updated `requirements.txt` to include new dependencies for environment variable management.
- Refactored metrics handling in the bot to ensure proper initialization and collection.
2025-08-29 23:15:06 +03:00
8cee629e28 Add middleware and refactor admin handlers for improved functionality
- Introduced `DependenciesMiddleware` and `BlacklistMiddleware` for enhanced request handling across all routers.
- Refactored admin handlers to utilize new middleware, improving access control and error handling.
- Updated the `admin_router` to include middleware for access checks and streamlined the process of banning users.
- Enhanced the structure of admin handler imports for better organization and maintainability.
- Improved error handling in various admin functions to ensure robust user interactions.
2025-08-28 23:54:17 +03:00
f75e7f82c9 Enhance private handlers structure and add database support
- Introduced a new `PrivateHandlers` class to encapsulate private message handling logic, improving organization and maintainability.
- Added new dependencies in `requirements.txt` for database support with `aiosqlite`.
- Updated the private handlers to utilize modular components for better separation of concerns and easier testing.
- Implemented error handling and logging for improved robustness in message processing.
2025-08-28 01:41:19 +03:00
e17a9f9c29 Remove pytest configuration file and update test files for async compatibility
- Deleted `pytest.ini` to streamline test configuration.
- Added `pytest_asyncio` plugin support in `conftest.py`.
- Marked `test_monitor` as an async test to ensure proper execution in an asynchronous context.
2025-08-27 22:37:17 +03:00
86b6903920 Add auto unban functionality and update related tests and dependencies 2025-08-27 20:56:22 +03:00
748670816f Refactor keyboard layout for improved organization and add admin keyboard tests
- Updated the keyboard layout in `get_reply_keyboard` and `get_reply_keyboard_admin` functions to use `row` for better organization of buttons.
- Added unit tests for the admin keyboard to verify button arrangement and functionality.
- Ensured that each button is placed in its own row for clarity in the user interface.
2025-08-27 20:20:53 +03:00
dc0e5d788c Implement OS detection and enhance disk monitoring in ServerMonitor
- Added OS detection functionality to the ServerMonitor class, allowing for tailored disk usage and uptime calculations based on the operating system (macOS or Ubuntu).
- Introduced methods for retrieving disk usage and I/O statistics specific to the detected OS.
- Updated the process status check to return uptime information for monitored processes.
- Enhanced the status message format to include disk space emojis and process uptime details.
- Updated tests to reflect changes in process status checks and output formatting.
2025-08-27 20:09:48 +03:00
0b2440e586 Add server monitoring functionality and update Makefile and requirements
- Introduced a new server monitoring module in `run_helper.py` with graceful shutdown handling.
- Updated `.gitignore` to include PID files.
- Added `test-monitor` target in `Makefile` for testing the server monitoring module.
- Included `psutil` in `requirements.txt` for system monitoring capabilities.
2025-08-27 01:17:15 +03:00
9688cdd85f Refactor admin handlers to improve access control and state management. Added checks for admin rights in ban functions and streamlined router inclusion order in main bot file. Updated keyboard layouts for better user experience and removed unused state definitions. 2025-08-27 00:28:32 +03:00
70d6ad9a6e Merge remote-tracking branch 'origin/voice-1' into merge-voice-1 2025-08-26 18:27:20 +03:00
7b6abe2a0e WIP: Temporary commit for branch move 2025-08-26 02:14:11 +03:00
502c07a2c9 some fix 2024-11-16 18:45:05 +03:00
Andrey
33fa84943d add answer for user 2024-07-21 13:24:18 +03:00
KatykhinAA
24ac638433 some fix 2024-07-13 12:42:21 +03:00
KatykhinAA
f2e44ddb29 add tests, some fixes 2024-07-10 23:18:36 +03:00