Commit Graph

155 Commits

Author SHA1 Message Date
fe06008930 Enhance metrics handling and logging in bot
- Integrated metrics scheduler start and stop functionality in `run_helper.py` for better resource management.
- Improved logging for metrics server operations in `server_prometheus.py`, ensuring clearer error reporting and status updates.
- Updated metrics middleware to collect comprehensive metrics for all event types, enhancing monitoring capabilities.
- Added active user metrics tracking in `admin_handlers.py` to provide insights on user engagement.
- Refactored command and callback handling in `metrics_middleware.py` to improve clarity and error handling.
2025-09-03 16:16:14 +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
6fcecff97c Refactor voice handler and update welcome message
- Reintroduced the cancel handler registration in the voice handler for private chats, ensuring users can cancel interactions with the bot.
- Updated the welcome message in the messages utility to reflect the new voice bot access method and added instructions for using the /restart command.
- Improved clarity in the welcome message by including a link to the bot's help command and contact information for user support.
2025-09-02 22:42:33 +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
3a7b0f6219 Add voice bot welcome tracking functionality
- Implemented methods to check and mark if a user has received a welcome message from the voice bot in both async and synchronous database classes.
- Updated database schema to include a new field for tracking welcome message status.
- Enhanced voice handler to utilize the new tracking methods, improving user interaction flow and engagement metrics.
2025-09-01 19:43:46 +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
d128e54694 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
2025-09-01 00:54:10 +03:00
2368af3d93 Merge branch 'dev-7' into dev-8 2025-08-31 23:38:57 +03:00
98d12be67d Initial commit for dev-8 branch with all current changes 2025-08-31 15:35:42 +03:00
5c2f9e501d Enhance user activity tracking in private handlers
- Added functionality to log user messages and update user activity in the suggest router, improving user engagement metrics.
2025-08-31 11:17:49 +03:00
5fa2468467 Update Dockerfile.bot to include SQLite installation and initialize database schema
- Added sqlite3 installation to Dockerfile for database support.
- Changed ownership commands to use fixed UID for non-root user.
- Initialized SQLite database with schema during the build process.
- Removed outdated migration scripts to streamline the project structure.
2025-08-31 11:06:32 +03:00
ANDREY KATYKHIN
378c287649 Merge pull request #9 from KerradKerridi/dev-6
Dev 6
2025-08-30 14:58:45 +03:00
ac2d17dfe2 Update database path in docker-compose.yml for consistency with project structure 2025-08-30 01:42:30 +03:00
67cfdece45 Update Dockerfile.bot to create non-root user with fixed UID for improved security 2025-08-30 01:28: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
f097d69dd4 Enhance Makefile and update metrics handling in bot
- Added new commands in the Makefile for restarting individual services: `restart-bot`, `restart-prometheus`, and `restart-grafana`.
- Updated Prometheus and Grafana dashboard expressions for better metrics aggregation.
- Removed the `main_with_metrics.py` file and integrated metrics handling directly into the main bot file.
- Refactored middleware to improve metrics tracking and error handling across message and callback processing.
- Optimized metrics recording with enhanced bucket configurations for better performance monitoring.
2025-08-29 18:23:17 +03:00
c68db87901 Refactor project structure and enhance Docker support
- Removed unnecessary `__init__.py` and `Dockerfile` to streamline project organization.
- Updated `.dockerignore` and `.gitignore` to improve exclusion patterns for build artifacts and environment files.
- Enhanced `Makefile` with new commands for managing Docker containers and added help documentation.
- Introduced `pyproject.toml` for better project metadata management and dependency tracking.
- Updated `requirements.txt` to reflect changes in dependencies for metrics and monitoring.
- Refactored various handler files to improve code organization and maintainability.
2025-08-29 16:49:28 +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
62af3b73c6 Enhance database connection handling in BotDB class with error checking for file existence and access permissions. Implement methods for database integrity checks and WAL file cleanup. Update database initialization to use absolute project path for improved reliability. 2025-08-26 19:33:11 +03:00
86773cfe20 fix 2025-08-26 19:20:25 +03:00
264818b0a6 Merge branch 'master' of https://github.com/KerradKerridi/telegram-helper-bot 2025-08-26 19:06:01 +03:00
706d91e739 Update requirements.txt to streamline dependencies, adding aiogram and pytest-asyncio while removing unused packages. Organized sections for core dependencies, logging, testing, and development tools. 2025-08-26 19:02:39 +03:00
ANDREY KATYKHIN
1a02f3c278 Merge pull request #8 from KerradKerridi/merge-voice-1
Merge voice 1
2025-08-26 18:57:53 +03:00
8bb098764d Refactor module imports to ensure project root is included in sys.path for both run_helper and voice_bot. Enhance database user insertion with backward compatibility for emoji column. Update user info handling to check username and full name more robustly. Improve emoji handling with fallback options for environments lacking the emoji package. 2025-08-26 18:56:47 +03:00
70d6ad9a6e Merge remote-tracking branch 'origin/voice-1' into merge-voice-1 2025-08-26 18:27:20 +03:00
ANDREY KATYKHIN
94ece4e307 Merge pull request #7 from KerradKerridi/dev-4
Dev 4
2025-08-26 17:41:36 +03:00
61dd85035d Update log retention period to 30 days in custom logger and add comment on log cleanup mechanism. 2025-08-26 17:23:20 +03:00
fee22f8ad4 Enhance database handling and improve HTML safety across the bot. Added async methods for blacklist checks, updated connection settings for SQLite, and implemented HTML escaping for user inputs and messages to prevent potential issues. Adjusted middleware latency and refactored various handlers for better performance and reliability. 2025-08-26 16:51:28 +03:00
7b6abe2a0e WIP: Temporary commit for branch move 2025-08-26 02:14:11 +03:00
Andrey
0c29609e4a hot fix 2024-11-17 22:43:41 +03:00
Andrey
cb0f94c718 some fix 2024-11-17 22:10:45 +03:00
b2c27040aa some fix with emoji function 2024-11-17 22:09:37 +03:00
Andrey
47c5b2f083 hotfix 2024-11-17 01:20:51 +03:00
Andrey
e0e0a6de51 add new func in voice bot 2024-11-17 00:50:55 +03:00
502c07a2c9 some fix 2024-11-16 18:45:05 +03:00
Andrey
ee9eafa09f some fix 2024-11-14 00:24:37 +03:00
ANDREY KATYKHIN
b8b92434ff Merge pull request #5 from KerradKerridi/dev-3
refactor voice_bot
2024-11-14 00:06:13 +03:00
Andrey
767acacc18 refactor voice_bot 2024-11-14 00:05:37 +03:00
ANDREY KATYKHIN
bc454fce8c Merge pull request #4 from KerradKerridi/dev-3
fix with html tags
2024-10-31 22:00:09 +03:00
5c3fece394 fix with html tags 2024-10-31 21:58:46 +03:00
ANDREY KATYKHIN
198b522976 Merge pull request #3 from KerradKerridi/dev-3
Dev-3 Добавил новые функции MediaGroup, разные типы файлов, ответы пользователю
2024-07-21 23:24:44 +05:00