Add presence heartbeat to keep bot shown as online

Adds a background asyncio.Task that calls set_presence("online") every
60 seconds to keep the homeserver presence status fresh. On startup the
bot sets itself online and spawns the heartbeat; on shutdown the task is
cancelled and presence is set to offline before closing the client.

https://claude.ai/code/session_01Nu3N2okrfJV3meatEmYdrB
This commit is contained in:
Claude
2026-02-28 08:14:46 +00:00
parent 123252e197
commit 30c9872d04
2 changed files with 52 additions and 1 deletions

View File

@@ -47,6 +47,9 @@ class DealsBot:
else:
self._first_run_done = True
# Start presence heartbeat so the bot shows as "online"
await self.matrix.start_presence_heartbeat()
async def stop(self):
"""Clean shutdown."""
await self._http.aclose()