2023-08-14 13:44:23 +00:00
|
|
|
---
|
|
|
|
title: "Rule Examples"
|
|
|
|
---
|
2021-09-22 14:10:57 +00:00
|
|
|
|
|
|
|
## Chat-addable generic text-respond-commands
|
|
|
|
|
|
|
|
```yaml
|
2023-08-14 13:44:23 +00:00
|
|
|
- uuid: 688e631f-08a8-5544-b4b2-1737ea71ce00
|
|
|
|
description: Trigger Generic Command
|
|
|
|
actions:
|
2021-09-22 14:10:57 +00:00
|
|
|
- type: respond
|
|
|
|
attributes:
|
2023-04-22 19:09:44 +00:00
|
|
|
message: '{{ variable (list "genericcmd" .channel (group 1) | join ":") }}'
|
2023-08-14 13:44:23 +00:00
|
|
|
cooldown: 1m0s
|
|
|
|
match_channels:
|
|
|
|
- '#luziferus'
|
|
|
|
- '#tezrian'
|
|
|
|
match_message: '^!([^\s]+)(?: |$)'
|
|
|
|
disable_on_template: '{{ eq (variable (list "genericcmd" .channel (group 1) | join ":")) "" }}'
|
|
|
|
|
|
|
|
- uuid: ba4f7bb3-af39-5c57-bb97-216a8af69246
|
|
|
|
description: Set Generic Command
|
|
|
|
actions:
|
2021-09-22 14:10:57 +00:00
|
|
|
- type: setvariable
|
|
|
|
attributes:
|
|
|
|
set: '{{ group 2 }}'
|
2023-08-14 13:44:23 +00:00
|
|
|
variable: '{{ list "genericcmd" .channel (group 1) | join ":" }}'
|
2021-09-22 14:10:57 +00:00
|
|
|
- type: respond
|
|
|
|
attributes:
|
|
|
|
message: '[Admin] Set command !{{ group 1 }} to "{{ group 2 }}"'
|
2023-08-14 13:44:23 +00:00
|
|
|
match_channels:
|
|
|
|
- '#luziferus'
|
|
|
|
- '#tezrian'
|
|
|
|
match_message: ^!setcmd ([^\s]+) (.*)
|
|
|
|
enable_on:
|
|
|
|
- broadcaster
|
|
|
|
- moderator
|
|
|
|
|
|
|
|
- uuid: 21619e80-2c6a-536e-8b83-e5fe6c580356
|
|
|
|
description: Clear Generic Command
|
|
|
|
actions:
|
2021-09-22 14:10:57 +00:00
|
|
|
- type: setvariable
|
|
|
|
attributes:
|
|
|
|
clear: true
|
2023-08-14 13:44:23 +00:00
|
|
|
variable: '{{ list "genericcmd" .channel (group 1) | join ":" }}'
|
2021-09-22 14:10:57 +00:00
|
|
|
- type: respond
|
|
|
|
attributes:
|
|
|
|
message: '[Admin] Deleted command !{{ group 1 }}'
|
2023-08-14 13:44:23 +00:00
|
|
|
match_channels:
|
|
|
|
- '#luziferus'
|
|
|
|
- '#tezrian'
|
|
|
|
match_message: ^!clearcmd ([^\s]+)
|
|
|
|
enable_on:
|
|
|
|
- broadcaster
|
|
|
|
- moderator
|
2021-09-22 14:10:57 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Game death counter with dynamic name
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
- actions:
|
|
|
|
- type: counter
|
|
|
|
attributes:
|
|
|
|
counter: '{{ channelCounter (recentGame .channel) }}'
|
|
|
|
- type: respond
|
|
|
|
attributes:
|
|
|
|
message: >-
|
|
|
|
I already died {{ counterValue (channelCounter (recentGame .channel)) }}
|
|
|
|
times in {{ recentGame .channel }}'
|
|
|
|
cooldown: 60s
|
|
|
|
enable_on: [broadcaster, moderator]
|
|
|
|
match_channels: ['#mychannel']
|
|
|
|
match_message: '^!death'
|
|
|
|
```
|
|
|
|
|
|
|
|
## Post follow date for an user
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
- actions:
|
|
|
|
- type: respond
|
|
|
|
attributes:
|
|
|
|
message: 'You followed on {{ ( followDate .username ( fixUsername .channel ) ).Format "2006-01-02" }}'
|
|
|
|
match_channels: ['#mychannel']
|
|
|
|
match_message: '^!followage'
|
|
|
|
```
|
|
|
|
|
|
|
|
## Respond to a message after random delay
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
- actions:
|
|
|
|
# Respond after 30-40s
|
|
|
|
- type: delay
|
|
|
|
attributes:
|
|
|
|
delay: 30s
|
|
|
|
jitter: 10s
|
|
|
|
- type: respond
|
|
|
|
attributes:
|
|
|
|
message: 'Hey {{ .username }}'
|
|
|
|
match_channels: ['#mychannel']
|
|
|
|
match_message: '^Hi'
|
|
|
|
```
|
|
|
|
|
|
|
|
## Send a notification on successful permit
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
- actions:
|
|
|
|
- type: respond
|
|
|
|
attributes:
|
2023-08-14 13:44:23 +00:00
|
|
|
message: '{{ mention .to }}, you will not get timed out for the next {{ .permitTimeout }} seconds.'
|
2021-09-22 14:10:57 +00:00
|
|
|
match_channels: ['#mychannel']
|
|
|
|
match_event: 'permit'
|
|
|
|
```
|
|
|
|
|
|
|
|
## Shoutout command with game query
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
- actions:
|
|
|
|
- type: respond
|
|
|
|
attributes:
|
|
|
|
message: >-
|
|
|
|
Check out @{{ fixUsername (group 1) }} and leave a follow,
|
|
|
|
they were last playing {{ recentGame (fixUsername (group 1)) "something mysterious" }}
|
|
|
|
at https://twitch.tv/{{ fixUsername (group 1) }}
|
|
|
|
enable_on: [broadcaster, moderator]
|
|
|
|
match_channels: ['#mychannel']
|
|
|
|
match_message: '^!so ([@\w]+)'
|
|
|
|
```
|
|
|
|
|