Commit Graph

728 Commits

Author SHA1 Message Date
Zakhar Izmaylov cdd233a7c6 Merge branch 'main' of https://github.com/izzzzzi/Solo_bot 2025-01-30 22:36:10 +03:00
Zakhar Izmaylov 83870a2022 Refactor and improve security with cryptographically secure random generation
- Replace `random` module with `secrets` for cryptographically secure random choices
- Update type hints for async API methods in client.py
- Optimize file reading with aiofiles in multiple handlers
- Improve error handling and logging in various modules
- Update Python target version to 3.12 in pyproject.toml
- Remove unused imports and improve code quality
2025-01-30 22:35:09 +03:00
GitHub Actions de45f5d377 Auto-format code with Ruff using pyproject.toml 2025-01-29 04:18:09 +00:00
Zakhar Izmaylov 32ba7b0a67 Minor whitespace adjustment in database connection closing 2025-01-29 07:17:53 +03:00
Zakhar Izmaylov af2b818186 Merge branch 'main' of https://github.com/izzzzzi/Solo_bot 2025-01-29 07:17:28 +03:00
Zakhar Izmaylov 7327a96730 Improve type hinting for database backup function
Update return type annotation for `_create_database_backup()` to use explicit tuple type syntax, enhancing type clarity and compatibility with modern Python type hinting practices.
2025-01-29 07:16:21 +03:00
GitHub Actions 6bffaab94f Auto-format code with Ruff using pyproject.toml 2025-01-29 04:15:40 +00:00
Zakhar Izmaylov 8ce7ee0ce0 Optimize import statements and remove unused imports across multiple files
This commit focuses on cleaning up import statements by:
- Removing unused imports
- Organizing import order
- Removing redundant imports
- Ensuring consistent import style across different modules
2025-01-29 07:15:20 +03:00
GitHub Actions 5f2b40b2d2 Auto-format code with Ruff using pyproject.toml 2025-01-29 04:01:20 +00:00
Zakhar Izmaylov a757852598 Merge branch 'main' of https://github.com/izzzzzi/Solo_bot 2025-01-29 07:01:01 +03:00
Vladislav Lisitsyn 62ad721262 add admin-panel by hteppl
reorganizing and optimizing the admin panel
2025-01-28 19:36:54 +03:00
Oleg Kraev ee155db444 Merge branch 'main' into dev 2025-01-24 23:35:19 +03:00
Zakhar Izmaylov 873b178151 Add inline button for user profile in admin panel message processing. Enhanced user interaction by including a button that directs users to their personal account, improving the overall user experience. 2025-01-23 14:43:39 +03:00
Zakhar Izmaylov ca2a720bfc Enhance error handling in backup cleanup process. Added a generic exception handler to log errors during the removal of old backups, improving robustness and maintainability of the backup functionality. 2025-01-23 12:10:08 +03:00
Zakhar Izmaylov 46ec8fef50 Update button labels from "🔙 Назад" to "⬅️ Назад" across multiple admin handlers and key management files for improved user interface consistency. This change enhances the visual clarity of navigation options within the application. 2025-01-23 12:06:38 +03:00
Zakhar Izmaylov 0890d326a4 Refactor trial management function names for clarity. Renamed set_trial to update_trial in database.py and updated all related handler calls in start.py, admin_user_editor.py, and trial_key.py to reflect this change. This improves code readability and consistency across the codebase. 2025-01-23 12:03:01 +03:00
GitHub Actions 39b998e6df Auto-format code with Ruff using pyproject.toml 2025-01-23 09:00:26 +00:00
Zakhar Izmaylov 5a0b157529 Merge branch 'main' of https://github.com/izzzzzi/Solo_bot 2025-01-23 12:00:10 +03:00
Zakhar Izmaylov 5be5cd33f7 Implement new database functions for server and coupon management. Added check_server_name_by_cluster, get_coupon_details, get_referral_by_referred_id, and get_all_keys to enhance data retrieval capabilities. Updated handlers to utilize these new functions, improving code clarity and maintainability. Refactored existing database calls in start.py, utils.py, and keys.py for consistency and better session management. 2025-01-23 11:58:35 +03:00
GitHub Actions 589851ae2c Auto-format code with Ruff using pyproject.toml 2025-01-23 08:40:44 +00:00
Zakhar Izmaylov f83a3a15a9 Merge branch 'main' of https://github.com/izzzzzi/Solo_bot 2025-01-23 11:40:25 +03:00
Zakhar Izmaylov 73a365eeb6 Refactor server management and database interactions. Renamed get_servers_from_db to get_servers for clarity and updated related handlers to utilize session management. Refactored add_server_to_db to create_server for consistency. Improved code readability and maintainability across coupon and notification handlers by streamlining database calls and enhancing error handling. 2025-01-23 11:36:15 +03:00
GitHub Actions 4cfaf41980 Auto-format code with Ruff using pyproject.toml 2025-01-23 08:28:39 +00:00
Zakhar Izmaylov 7dafb47c38 Enhance database interaction in coupon and server management. Updated check_unique_server_name to accept session and cluster name parameters for improved uniqueness checks. Introduced new functions: get_coupon_by_code, delete_server, create_coupon_usage, check_coupon_usage, and update_coupon_usage_count for better coupon management. Refactored handlers to utilize these new functions, improving code clarity and maintainability. 2025-01-23 11:28:21 +03:00
Zakhar Izmaylov 906601f5cd Refactor database interaction in key management functions to utilize session objects for improved performance and consistency. Updated get_keys, get_keys_by_server, update_balance, and update_key_expiry functions to accept a session parameter, allowing for better session management across handlers. Adjusted related handler functions to pass the session, enhancing code clarity and maintainability. 2025-01-23 11:06:25 +03:00
Zakhar Izmaylov e42a66dde7 Refactor database interaction functions in database.py and update related handlers. Renamed functions for clarity: save_temporary_data to create_temporary_data, add_blocked_user to create_blocked_user, remove_blocked_user to delete_blocked_user, and delete_coupon_from_db to delete_coupon. Updated trial management function from restore_trial to set_trial to better reflect its purpose. Adjusted corresponding calls in notifications, start, user, and admin handlers for consistency and improved readability. 2025-01-23 10:38:32 +03:00
Zakhar Izmaylov 31dd3d6654 Refactor client management in key_utils.py and trial_key.py to utilize ClientConfig dataclass for improved parameter handling. This change enhances code clarity and maintainability by consolidating client configuration parameters into a single structured object, streamlining the add_client function calls across multiple handlers. 2025-01-23 10:24:16 +03:00
Zakhar Izmaylov a9d1c0b75a Refactor backup sending logic in backup.py to remove redundant document sending for admin IDs. Streamlined the process by ensuring only the necessary admin IDs receive the backup document, enhancing code clarity and reducing potential errors in the backup notification process. 2025-01-23 08:54:22 +03:00
Zakhar Izmaylov c850698703 Refactor client configuration and improve code clarity in client.py and admin_servers.py. Added a new line in ClientConfig for better readability and updated the extend_client_key function signature for consistency. Corrected a TODO comment format in admin_servers.py for improved code standards. 2025-01-23 08:50:04 +03:00
Zakhar Izmaylov 70e9bfc2ca Refactor client management functions in client.py to use a dataclass for client configuration. Update add_client, extend_client_key, and delete_client functions to improve parameter handling and logging. Enhance error handling and documentation for better clarity and maintainability. 2025-01-23 08:49:03 +03:00
GitHub Actions 533e1283ea Auto-format code with Ruff using pyproject.toml 2025-01-23 05:42:01 +00:00
Zakhar Izmaylov 17d519d440 Refactor key retrieval and management logic across multiple handlers. Update get_key_details to include email in the fetched record and replace direct SQL queries with dedicated functions for improved code clarity and maintainability. Add a TODO comment in admin_servers.py for future enhancements. 2025-01-23 08:41:44 +03:00
Zakhar Izmaylov 4dcfa31331 Add server management functionality by introducing add_server_to_db function for streamlined database interactions. Refactor server addition logic in sync_servers_with_db and admin handlers to utilize the new function, enhancing code clarity and session management. 2025-01-23 08:03:58 +03:00
Zakhar Izmaylov 2d638b0c82 Refactor key management functions to improve database interactions by consolidating key deletion logic into a single function. Introduce timezone-aware expiry date calculations for keys and enhance key retrieval processes across various handlers. Update the start command to utilize a dedicated function for adding connections, ensuring cleaner code and better session management. 2025-01-23 07:49:21 +03:00
Zakhar Izmaylov 311c48edcd Refactor code to utilize aiofiles for asynchronous file handling across multiple modules. Added a new function to remove blocked users from the database and updated user blocking/unblocking logic to use this new function. Improved database interaction in admin panel handlers by passing session objects instead of creating new connections. This enhances performance and maintains consistency in file operations. 2025-01-23 06:34:45 +03:00
GitHub Actions 845a8c8671 Auto-format code with Ruff using pyproject.toml 2025-01-23 03:15:11 +00:00
Zakhar Izmaylov b78e1148d1 Update .gitignore to include logs and setup.py, and remove unnecessary entries 2025-01-23 06:14:48 +03:00
Zakhar Izmaylov cc7d15390d Merge branch 'main' of https://github.com/izzzzzi/Solo_bot 2025-01-23 06:14:33 +03:00
Zakhar Izmaylov 3af4afd159 Update balance retrieval to round values to one decimal place in database.py 2025-01-23 05:49:24 +03:00
Vladless 65a7e7f9b0 minor_fixes 2025-01-22 18:46:16 +03:00
Zakhar Izmaylov c87ec273e5 Add directory creation for database backups in backup.py 2025-01-22 10:31:03 +03:00
Vladless a8f3187e84 location-selection/major_update_notifications/gifts and more fixes 2025-01-21 22:43:18 +03:00
Vladless eb666ca3a4 location-selection/major_update_notifications/gifts and more fixes 2025-01-21 22:43:18 +03:00
hteppl e9671baf65 Implement .github folder for github-related data 2025-01-21 18:04:41 +03:00
Zakhar Izmaylov 8667ae3a23 Refactor file handling to use aiofiles for asynchronous operations
- Replaced synchronous file reading with asynchronous file handling using aiofiles in multiple handlers and the backup module.
- Improved performance and responsiveness when sending images and backups by utilizing async file operations.
- Ensured consistent use of BufferedInputFile across all relevant functions for better code maintainability.
2025-01-21 12:03:56 +03:00
Zakhar Izmaylov acb73101c0 Refactor and clean up code formatting across multiple files
- Consolidated and simplified code formatting by removing unnecessary line breaks and improving readability in various functions.
- Updated the handling of backup file sending in backup.py for better clarity.
- Streamlined error handling and logging messages in several handlers to enhance consistency.
- Adjusted the Makefile to exclude specific files during Ruff checks and formatting.
- Made minor adjustments to function signatures and parameter handling for improved clarity and consistency.

This commit enhances code maintainability and readability without altering functionality.
2025-01-21 08:57:12 +03:00
Zakhar Izmaylov ffc18f4056 Refactor private message filter in bot.py
- Renamed IsPrivate to IsPrivateFilter for clarity and consistency.
- Updated message and callback query filters to use the new IsPrivateFilter class.
2025-01-20 22:38:52 +03:00
Zakhar Izmaylov 7802af7d41 Refactor captcha response handling in check_captcha function
- Removed the deletion of the original message upon correct captcha response.
- Changed the method of sending the captcha text and markup from edit_text to answer for better user experience.
2025-01-20 22:31:14 +03:00
Zakhar Izmaylov 84831a7290 Add captcha functionality to start command handler
- Included captcha router in main handlers.
- Integrated captcha generation in the start command, conditional on CAPTCHA_ENABLE setting.
2025-01-20 22:27:39 +03:00
Zakhar Izmaylov b01e4db2b2 Update work from blocked_users 2025-01-20 03:47:16 +03:00