diff options
author | babolivier <babolivier@users.noreply.github.com> | 2021-10-26 13:18:04 +0000 |
---|---|---|
committer | babolivier <babolivier@users.noreply.github.com> | 2021-10-26 13:18:04 +0000 |
commit | fe35a0497c61bd1f3769a63bd0f1ebc2e41cf2f1 (patch) | |
tree | 81d59aafab90d674b43e6ea5d3258f4461f1ab37 /develop/modules | |
parent | deploy: cc75a6b1b20f599c6ec6699fb77c8a72b87d1ec2 (diff) | |
download | synapse-fe35a0497c61bd1f3769a63bd0f1ebc2e41cf2f1.tar.xz |
deploy: c7a5e49664ab0bd18a57336e282fa6c3b9a17ca0
Diffstat (limited to 'develop/modules')
-rw-r--r-- | develop/modules/third_party_rules_callbacks.html | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/develop/modules/third_party_rules_callbacks.html b/develop/modules/third_party_rules_callbacks.html index 7d9f8f0aac..789e2e40ca 100644 --- a/develop/modules/third_party_rules_callbacks.html +++ b/develop/modules/third_party_rules_callbacks.html @@ -270,6 +270,20 @@ boolean indicating whether the change can go through.</p> callback returns <code>True</code>, Synapse falls through to the next one. The value of the first callback that does not return <code>True</code> will be used. If this happens, Synapse will not call any of the subsequent implementations of this callback.</p> +<h3 id="on_new_event"><a class="header" href="#on_new_event"><code>on_new_event</code></a></h3> +<p><em>First introduced in Synapse v1.47.0</em></p> +<pre><code class="language-python">async def on_new_event( + event: "synapse.events.EventBase", + state_events: "synapse.types.StateMap", +) -> None: +</code></pre> +<p>Called after sending an event into a room. The module is passed the event, as well +as the state of the room <em>after</em> the event. This means that if the event is a state event, +it will be included in this state.</p> +<p>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 <a href="spam_checker_callbacks.html#check_event_for_spam"><code>check_event_for_spam</code></a> instead.</p> +<p>If multiple modules implement this callback, Synapse runs them all in order.</p> <h2 id="example"><a class="header" href="#example">Example</a></h2> <p>The example below is a module that implements the third-party rules callback <code>check_event_allowed</code> to censor incoming messages as dictated by a third-party service.</p> |