From d41b588adcf2d043a3a1bce269e27fb388e0ceb1 Mon Sep 17 00:00:00 2001 From: nikita Date: Wed, 2 Sep 2026 13:54:55 +0300 Subject: [PATCH] Updated to 0.0.2. Fixed "invalid room" bug `2026-matrix-csonac` (it uses this package) failed to send messages to the room after bot restart. The problem would go away if the bot received some message in the room it was trying to send a message to. This commit fixes the problem. - Added `load_store` (issue #1) - Added `full_state=True` to sync_forever --- pyproject.toml | 2 +- src/mab/bot.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 50af0e4..08f9092 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "mab" -version = "0.0.1" +version = "0.0.2" authors = [ { name = "Tyukalov Nikita", email = "nikita@tyukalov.su" } ] diff --git a/src/mab/bot.py b/src/mab/bot.py index 3f06ea5..ea104a1 100644 --- a/src/mab/bot.py +++ b/src/mab/bot.py @@ -263,6 +263,7 @@ class MatrixBot: user_id=username, **session_data ) + self._client.load_store() result = await self._client.whoami() if type(result) is WhoamiError: self._logger.error(f"Can't log in using stored session data: '{result.message}'") @@ -369,7 +370,8 @@ class MatrixBot: sync_task = asyncio.create_task( self._client_cancellable_sync_forever( timeout=self.MATRIX_SYNC_PERIOD, - since=(await self._read_next_batch()) + since=(await self._read_next_batch()), + full_state=True ) ) try: