Repository navigation
Refactor Message Handling and Reaction API - #9
Closed
chrisdedman wants to merge 42 commits into
Closed
chrisdedman wants to merge 42 commits into
chrisdedman wants to merge 42 commits into
Conversation
…mprove parameter handling
…d improve reaction handling
…y parameters in send methods
…tion. The reason is because we are using type hints which having it also in the docstring just duplicate unecessarly.
PenguinBoi12
requested changes
Dec 20, 2025
PenguinBoi12
left a comment
Contributor
There was a problem hiding this comment.
A few small thing to change but otherwise good.
PenguinBoi12
requested changes
Dec 21, 2025
| :return: The constructed Message instance. | ||
| :raise MissingArgumentError: If event is None. | ||
| """ | ||
| if event is None: |
Contributor
There was a problem hiding this comment.
This is not necessary since we pass an event.
|
|
||
| :return: The constructed Message instance. | ||
| """ | ||
| if not event and not bot: |
Contributor
There was a problem hiding this comment.
This shouldn't happen since we have bot and event as parameter
| """ | ||
| try: | ||
| msg = Message(self.bot) | ||
| msg = self.get_message(self.bot, event) |
Contributor
There was a problem hiding this comment.
We can probably get ride of get_message for now and use from_event directly
| event_id = event.event_id | ||
| body = event.body | ||
|
|
||
| return Message( |
Contributor
There was a problem hiding this comment.
I feel like we should pass the the event now
| if event is None: | ||
| raise ValueError("event cannot be None") | ||
|
|
||
| if isinstance(event, Event) and event.source["type"] == "m.reaction": |
Contributor
There was a problem hiding this comment.
This doesn't make sense either. It should always be an instance of event.cif they goal is to check the type just check the types you don't have to check the instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Refactored message and reaction handling to simplify the API and clean up reaction sending. Updated examples and internal methods to match the new interface.