From 04d415810d5c869ee89d3a6288024dd6ca83357b Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Wed, 30 Jun 2021 01:37:41 +0200 Subject: [PATCH] Add example for generic chat-addable commands Signed-off-by: Knut Ahlers --- wiki/Home.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/wiki/Home.md b/wiki/Home.md index f9dd6e4..ba9a8ea 100644 --- a/wiki/Home.md +++ b/wiki/Home.md @@ -207,6 +207,35 @@ The example was dumped using this action: ## Rule examples +### Chat-addable generic text-respond-commands + +```yaml + # Respond with variable content if set + - actions: + - respond: '{{ variable (concat ":" "genericcmd" .channel (group 1)) }}' + disable_on_template: '{{ eq (variable (concat ":" "genericcmd" .channel (group 1))) "" }}' + match_channels: ['#mychannel'] + match_message: '^!([^\s]+)(?: |$)' + + # Set variable content to content of chat command + - actions: + - variable: '{{ concat ":" "genericcmd" .channel (group 1) }}' + set: '{{ group 2 }}' + - respond: '[Admin] Set command !{{ group 1 }} to "{{ group 2 }}"' + enable_on: [broadcaster, moderator] + match_channels: ['#mychannel'] + match_message: '^!setcmd ([^\s]+) (.*)' + + # Remove variable and therefore delete command + - actions: + - variable: '{{ concat ":" "genericcmd" .channel (group 1) }}' + clear: true + - respond: '[Admin] Deleted command !{{ group 1 }}' + enable_on: [broadcaster, moderator] + match_channels: ['#mychannel'] + match_message: '^!clearcmd ([^\s]+)' +``` + ### Game death counter with dynamic name ```yaml