Skip to content

V0.3.0

Latest

Choose a tag to compare

@sina8013 sina8013 released this 27 Sep 11:16
783e450

The improved script introduces several key enhancements that make it cleaner, safer, and more reliable. First, the encryption logic was fixed by removing the class-wide salt and instead generating a fresh random salt during each encryption, ensuring that decryption remains consistent while improving security. The code structure was simplified by separating responsibilities, giving encryption its own helper class and making database operations easier to follow. Method names were adjusted to be more Pythonic, using single underscores for private helpers rather than dunder methods. Error handling was added around decryption, JSON parsing, and SQL execution, preventing silent crashes and providing clear feedback when something goes wrong. File handling was modernized by using Path.read_text() instead of blocking file operations, which is cleaner and less error-prone. JSON storage was optimized by switching to a compact format (no unnecessary indentation), making message transfers in Telegram more efficient. Logging messages were also added so it’s clear when the script connects, initializes, updates, or encounters an error. Overall, the refactored version is more secure, maintainable, efficient, and aligned with Python best practices.