This change introduces native `matrix:` URI-based rendering for `{user}` and `{room}` placeholders,
replacing previous plaintext and matrix.to-based links. Users and rooms are now rendered as clickable
pills in supporting clients, with a clean display using display names and room names (no @/# prefixes).
Reporting, moderation, and auto-redaction messages have been updated to use the same rendering logic.
Inspect and event links now also use native `matrix:` URIs for direct in-client navigation.
Internally, URI generation and rendering logic have been unified via central helper functions,
ensuring consistent handling of user IDs, room IDs, aliases, and event IDs.
This commit also includes a broader refactor of the codebase:
- decomposed complex flows (e.g. join handling) into smaller helpers
- moved mutable class-level state to instance-level
- reduced duplicate API calls and redundant logic
- improved overall structure and maintainability
Test coverage has been extended for URI helpers and rendering logic to prevent regressions.
No breaking changes to existing template parameters like `{user_link}` or `{room_link}`.
- Enhanced the join notification logic to support the {room_id} placeholder.
- This allows administrators to include direct matrix.to deep links in notification messages.
- Added a safety fallback that uses the room ID as the name if the room has no display name set.
- Fixed a bug where a string literal "sleep" was passed to the delay function.
- Switched from blocking time.sleep() to non-blocking await asyncio.sleep() to ensure the bot remains responsive during large purge operations.
- The delay now correctly pulls the numerical value from self.config["sleep"].
fix: resolve room aliases in setpower and filter unjoined space rooms
This commit addresses two issues that caused API errors during room iteration and power level syncing:
1. Filter unjoined rooms in `get_space_roomlist`:
Previously, the bot assumed it was a member of all child rooms returned by the parent space state. If the bot was missing from certain child rooms, it threw errors during subsequent operations. The room list is now intersected with `await self.client.get_joined_rooms()` to safely ignore rooms the bot hasn't actually joined yet. Logging has been added to indicate when rooms are skipped.
2. Fix alias resolution (Sigil Bug) in `room_setpower`:
The `room_setpower <target_room>` command failed when users provided a standard room alias (starting with `#`) instead of an internal room ID (`!`), as the Matrix API expects the internal ID for state event operations. Added logic to detect aliases and explicitly resolve them to their respective `room_id` via `self.client.resolve_room_alias()` before attempting to update power levels. Appropriate error handling was also added to notify the user if the alias cannot be resolved.
The insert or update logic would not work with postgresql. The new
implementation is database agnostic, so long as the response is still
the same on sqllite