Repository navigation
chore: proteger arranque con if __name__ == '__main__' - #39
Merged
Merged
Conversation
Collaborator
Author
|
Resuelto en |
ranto-dev05
marked this pull request as draft
August 15, 2026 22:15
Axel-DaMage
approved these changes
Aug 15, 2026
ranto-dev05
marked this pull request as ready for review
August 15, 2026 22:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Se envuelve el arranque del bot en una función
main()protegida porif __name__ == "__main__"enmain.py, de modo quebot.run()solo se ejecuta cuando el archivo es el punto de entrada (python main.py) y no al importarlo como módulo, facilitando pruebas unitarias y reutilización sin conexiones de red; el funcionamiento manual queda idéntico porquevalidate_settings(),init_database()y la creación del objetobotpermanecen a nivel de módulo y la guarda solo aísla el chequeo de token ybot.run(). Closes #4. Para verificarlo en menos de un minuto: importa el módulo conpython -c "import main"y confirma que no llama abot.run(), y quepython main.pysigue arrancando igual que antes.