From 05e479bb8839e8807509a1ebf4a42dfc22829035 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 16 Jun 2021 22:24:52 +0300 Subject: [PATCH] Add example for random reactions --- README.md | 2 ++ samples/random-reaction.yaml | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 samples/random-reaction.yaml diff --git a/README.md b/README.md index 049a400..947e429 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/samples/random-reaction.yaml b/samples/random-reaction.yaml new file mode 100644 index 0000000..4784bef --- /dev/null +++ b/samples/random-reaction.yaml @@ -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: + - ๐Ÿค” + - ๐Ÿง + - ๐Ÿคจ