-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy paththread.yaml
50 lines (48 loc) · 1.53 KB
/
thread.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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