1 Commits

Author SHA1 Message Date
d41b588adc 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
2026-09-02 13:54:55 +03:00
2 changed files with 4 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "mab" name = "mab"
version = "0.0.1" version = "0.0.2"
authors = [ authors = [
{ name = "Tyukalov Nikita", email = "nikita@tyukalov.su" } { name = "Tyukalov Nikita", email = "nikita@tyukalov.su" }
] ]

View File

@@ -263,6 +263,7 @@ class MatrixBot:
user_id=username, user_id=username,
**session_data **session_data
) )
self._client.load_store()
result = await self._client.whoami() result = await self._client.whoami()
if type(result) is WhoamiError: if type(result) is WhoamiError:
self._logger.error(f"Can't log in using stored session data: '{result.message}'") 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( sync_task = asyncio.create_task(
self._client_cancellable_sync_forever( self._client_cancellable_sync_forever(
timeout=self.MATRIX_SYNC_PERIOD, timeout=self.MATRIX_SYNC_PERIOD,
since=(await self._read_next_batch()) since=(await self._read_next_batch()),
full_state=True
) )
) )
try: try: