Add example for random reactions

This commit is contained in:
Tulir Asokan 2021-06-16 22:24:52 +03:00
parent e89a5773d8
commit 05e479bb88
2 changed files with 27 additions and 0 deletions

View file

@ -7,6 +7,8 @@ A [maubot](https://github.com/maubot/maubot) that responds to messages that matc
and an image response for "alot".
* [samples/jesari.yaml](samples/jesari.yaml) contains a replacement for [jesaribot](https://github.com/maubot/jesaribot).
* [samples/stallman.yaml](samples/stallman.yaml) contains a Stallman interject bot.
* [samples/random-reaction.yaml](samples/random-reaction.yaml) has an example of
a randomized reaction to matching messages.
## Config format
### Templates

View file

@ -0,0 +1,25 @@
templates:
random_reaction:
type: m.reaction
variables:
react_to_event: '{{event.event_id}}'
reaction: '{{ variables.reaction_choices | random }}'
content:
m.relates_to:
rel_type: m.annotation
event_id: $${react_to_event}
key: $${reaction}
default_flags:
- ignorecase
rules:
random:
matches:
- hmm
template: random_reaction
variables:
reaction_choices:
- 🤔
- 🧐
- 🤨