Skip to content

Enrich event handlers with Room and improve Message API#38

Merged
PenguinBoi12 merged 4 commits intomainfrom
custom-room-in-events
Apr 7, 2026
Merged

Enrich event handlers with Room and improve Message API#38
PenguinBoi12 merged 4 commits intomainfrom
custom-room-in-events

Conversation

@PenguinBoi12
Copy link
Copy Markdown
Contributor

Previously, Matrix event handlers received a raw MatrixRoom object from nio, giving no access to our abstractions like send(). This PR passes our own Room wrapper instead, making the full bot API available directly inside event handlers.

Room:

  • Event handlers now receive a Room instance instead of MatrixRoom, enabling calls to send(), invite_user(), etc. directly from handlers
  • Added fetch_event to retrieve a raw nio Event by id from the homeserver
  • Added fetch_message to retrieve a fully constructed Message by event id

Message:

  • Message is now built with an Event object instead of just an event_id, giving access to all event data.
  • Added fetch_reactions which returns a list[Reaction].

Copy link
Copy Markdown
Contributor

@chrisdedman chrisdedman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. LGTM

@PenguinBoi12 PenguinBoi12 merged commit ba1ba5d into main Apr 7, 2026
4 checks passed
@PenguinBoi12 PenguinBoi12 deleted the custom-room-in-events branch April 7, 2026 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants