mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-12-20 11:51:17 +00:00
Allow to skip cooldown on script error
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
6a154008f2
commit
ac751605a8
2 changed files with 5 additions and 2 deletions
|
@ -18,7 +18,8 @@ func init() {
|
|||
}
|
||||
|
||||
type ActorScript struct {
|
||||
Command []string `json:"command" yaml:"command"`
|
||||
Command []string `json:"command" yaml:"command"`
|
||||
SkipCooldownOnError bool `json:"skip_cooldown_on_error" yaml:"skip_cooldown_on_error"`
|
||||
}
|
||||
|
||||
func (a ActorScript) Execute(c *irc.Client, m *irc.Message, r *plugins.Rule, eventData plugins.FieldCollection) (preventCooldown bool, err error) {
|
||||
|
@ -66,7 +67,7 @@ func (a ActorScript) Execute(c *irc.Client, m *irc.Message, r *plugins.Rule, eve
|
|||
cmd.Stdout = stdout
|
||||
|
||||
if err := cmd.Run(); err != nil {
|
||||
return false, errors.Wrap(err, "running command")
|
||||
return a.SkipCooldownOnError, errors.Wrap(err, "running command")
|
||||
}
|
||||
|
||||
if stdout.Len() == 0 {
|
||||
|
|
|
@ -47,6 +47,8 @@ rules: # See below for examples
|
|||
|
||||
# Command to execute for the chat message, must return an JSON encoded array of actions
|
||||
- command: [/bin/bash, -c, "echo '[{\"respond\": \"Text\"}]'"]
|
||||
skip_cooldown_on_error: true # Boolean, optional, if set to true a non-zero exit-code
|
||||
# will prevent the cooldown to be started for the rule
|
||||
|
||||
# Modify an internal counter value (does NOT send a chat line)
|
||||
- counter: "counterid" # String to identify the counter, applies templating
|
||||
|
|
Loading…
Reference in a new issue