From 45e22185dcb34d45a3d66d17642437713ac6a3cf Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 18 Jul 2021 19:45:35 +0300 Subject: [PATCH] Add capture group example --- README.md | 2 ++ samples/nitter.yaml | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 samples/nitter.yaml diff --git a/README.md b/README.md index 947e429..fef4f88 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ A [maubot](https://github.com/maubot/maubot) that responds to messages that matc * [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. +* [samples/nitter.yaml](samples/nitter.yaml) has an example of matching tweet links + and responding with a corresponding nitter.net link. ## Config format ### Templates diff --git a/samples/nitter.yaml b/samples/nitter.yaml new file mode 100644 index 0000000..3cfb856 --- /dev/null +++ b/samples/nitter.yaml @@ -0,0 +1,15 @@ +templates: + nitter: + type: m.room.message + content: + msgtype: m.text + body: https://nitter.net/$${1}/status/$${2} + +default_flags: +- ignorecase + +rules: + twitter: + matches: + - https://twitter.com/(.+?)/status/(\d+) + template: nitter