From 01b34783cf07c93fcfd810662e10a737d671bb81 Mon Sep 17 00:00:00 2001 From: Finn Christiansen Date: Tue, 19 Nov 2024 22:41:01 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=93=9D=20update=20README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7f87156..2af96ba 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,22 @@ The bot calls the Api and sends the invitation link via e-mail to a given receip ## Usage -Use container image or run this after cloning: +Use container image or run this after cloning. In both cases you need to create a `.env` file containing the matrix and mail server credentials: + +``` +cp. .env.example .env +``` + +If you want to run it without the container you can run it like this: + ``` . bin/activate python -m matrix_bot_invitation_mailer ``` +And for use with docker run it like this: + +``` +docker compose up -d +``` From cb451f02afa33951563bad2f584c5f215b4a92fc Mon Sep 17 00:00:00 2001 From: Finn Christiansen Date: Tue, 19 Nov 2024 22:41:29 +0100 Subject: [PATCH 2/2] :bug: catch another Exception (e.g. ValueError("Invalid Homeserver")) and try to reconnect --- matrix_bot_invitation_mailer/__main__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/matrix_bot_invitation_mailer/__main__.py b/matrix_bot_invitation_mailer/__main__.py index 3ad815c..fbcf45d 100644 --- a/matrix_bot_invitation_mailer/__main__.py +++ b/matrix_bot_invitation_mailer/__main__.py @@ -117,9 +117,9 @@ The link will be valid for 7 days.""".format(os.getenv("REGISTRATION_URL") + res while True: try: bot.run() - except ServerDisconnectedError: - time.sleep(5) + except (ServerDisconnectedError, ValueError): logging.info("connection lost, reconnecting in 5 seconds...") + time.sleep(5) except KeyboardInterrupt: logging.info("exiting...") sys.exit(0)