diff options
author | Brendan Abolivier <babolivier@matrix.org> | 2021-10-26 15:17:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-26 15:17:36 +0200 |
commit | c7a5e49664ab0bd18a57336e282fa6c3b9a17ca0 (patch) | |
tree | eba568a8f118fe8eb9f83b1302ab3104f55a6171 /docs | |
parent | Move DNS lookups into separate thread pool (#11177) (diff) | |
download | synapse-c7a5e49664ab0bd18a57336e282fa6c3b9a17ca0.tar.xz |
Implement an `on_new_event` callback (#11126)
Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/modules/third_party_rules_callbacks.md | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/docs/modules/third_party_rules_callbacks.md b/docs/modules/third_party_rules_callbacks.md index 034923da0f..a16e272f79 100644 --- a/docs/modules/third_party_rules_callbacks.md +++ b/docs/modules/third_party_rules_callbacks.md @@ -119,6 +119,27 @@ callback returns `True`, Synapse falls through to the next one. The value of the callback that does not return `True` will be used. If this happens, Synapse will not call any of the subsequent implementations of this callback. +### `on_new_event` + +_First introduced in Synapse v1.47.0_ + +```python +async def on_new_event( + event: "synapse.events.EventBase", + state_events: "synapse.types.StateMap", +) -> None: +``` + +Called after sending an event into a room. The module is passed the event, as well +as the state of the room _after_ the event. This means that if the event is a state event, +it will be included in this state. + +Note that this callback is called when the event has already been processed and stored +into the room, which means this callback cannot be used to deny persisting the event. To +deny an incoming event, see [`check_event_for_spam`](spam_checker_callbacks.md#check_event_for_spam) instead. + +If multiple modules implement this callback, Synapse runs them all in order. + ## Example The example below is a module that implements the third-party rules callback |