diff --git a/action_script.go b/action_script.go index 333a224..2122e3e 100644 --- a/action_script.go +++ b/action_script.go @@ -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 { diff --git a/wiki/Home.md b/wiki/Home.md index 8ce20cc..085bd45 100644 --- a/wiki/Home.md +++ b/wiki/Home.md @@ -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