50 lines
1.5 KiB
YAML
50 lines
1.5 KiB
YAML
templates:
|
|
always_in_thread:
|
|
type: m.room.message
|
|
variables:
|
|
thread_parent: '{{event.content.get_thread_parent() or event.event_id}}'
|
|
event_id: '{{event.event_id}}'
|
|
content:
|
|
msgtype: m.text
|
|
body: $${text}
|
|
m.relates_to:
|
|
rel_type: m.thread
|
|
event_id: $${thread_parent}
|
|
is_falling_back: true
|
|
m.in_reply_to:
|
|
event_id: $${event_id}
|
|
# Reply in thread if the message is already in a thread, otherwise use a normal reply.
|
|
# This currently requires using a jinja template as the content instead of a normal yaml map.
|
|
thread_or_reply:
|
|
type: m.room.message
|
|
variables:
|
|
relates_to: |
|
|
{{
|
|
{"rel_type": "m.thread", "event_id": event.content.get_thread_parent(), "is_falling_back": True, "m.in_reply_to": {"event_id": event.event_id}}
|
|
if event.content.get_thread_parent()
|
|
else {"m.in_reply_to": {"event_id": event.event_id}}
|
|
}}
|
|
content:
|
|
msgtype: m.text
|
|
body: $${text}
|
|
m.relates_to: $${relates_to}
|
|
|
|
antispam:
|
|
room:
|
|
max: 60
|
|
delay: 60
|
|
user:
|
|
max: 60
|
|
delay: 60
|
|
|
|
rules:
|
|
thread:
|
|
matches: [^!thread$]
|
|
template: always_in_thread
|
|
variables:
|
|
text: meow 3:<
|
|
maybe_thread:
|
|
matches: [^!thread --maybe$]
|
|
template: thread_or_reply
|
|
variables:
|
|
text: meow >:3
|