mirror of
https://github.com/element-hq/synapse
synced 2024-08-18 21:30:54 +00:00
deploy: c7a5e49664
This commit is contained in:
parent
ab7e599082
commit
fe35a0497c
4 changed files with 30 additions and 2 deletions
|
@ -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>
|
||||
|
|
|
@ -8057,6 +8057,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="modules/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-1"><a class="header" href="#example-1">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>
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue