-
-
Notifications
You must be signed in to change notification settings - Fork 118
api(jsonrpc): add run_until parameter for bots #7688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This commit also makes testing hooks easier, as it allows to process events and run hooks on them, until a certain event occurs.
1830b9d to
3d492bb
Compare
| until_func: Callable[[AttrDict], bool], | ||
| until_event: EventType = False, | ||
| ) -> AttrDict: | ||
| """Process events until the given callable evaluates to True. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation needs to be updated
| self._process_messages() | ||
|
|
||
| stop = func(event) | ||
| if event.kind == until_event: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe do this check after calling until_func? Calling it one more time may be useful, e.g. for logging purposes, and it even goes before until_event in the _process_events() parameter list
Co-authored-by: iequidoo <117991069+iequidoo@users.noreply.github.com>
This commit also makes testing hooks easier, as it allows to process events and run hooks on them, until a certain event occurs.