mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-09 16:50:01 +00:00
Add counter_set support
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
31ca8ee35c
commit
6a218030a0
3 changed files with 9 additions and 0 deletions
|
@ -16,6 +16,13 @@ func init() {
|
||||||
return errors.Wrap(err, "preparing response")
|
return errors.Wrap(err, "preparing response")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if r.CounterSet != nil {
|
||||||
|
return errors.Wrap(
|
||||||
|
store.UpdateCounter(counterName, *r.CounterSet, true),
|
||||||
|
"set counter",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
var counterStep int64 = 1
|
var counterStep int64 = 1
|
||||||
if r.CounterStep != nil {
|
if r.CounterStep != nil {
|
||||||
counterStep = *r.CounterStep
|
counterStep = *r.CounterStep
|
||||||
|
|
|
@ -179,6 +179,7 @@ func (r *rule) Matches(m *irc.Message, event *string) bool {
|
||||||
type ruleAction struct {
|
type ruleAction struct {
|
||||||
Ban *string `json:"ban" yaml:"ban"`
|
Ban *string `json:"ban" yaml:"ban"`
|
||||||
Command []string `json:"command" yaml:"command"`
|
Command []string `json:"command" yaml:"command"`
|
||||||
|
CounterSet *int64 `json:"counter_set" yaml:"counter_set"`
|
||||||
CounterStep *int64 `json:"counter_step" yaml:"counter_step"`
|
CounterStep *int64 `json:"counter_step" yaml:"counter_step"`
|
||||||
Counter *string `json:"counter" yaml:"counter"`
|
Counter *string `json:"counter" yaml:"counter"`
|
||||||
DeleteMessage *bool `json:"delete_message" yaml:"delete_message"`
|
DeleteMessage *bool `json:"delete_message" yaml:"delete_message"`
|
||||||
|
|
|
@ -24,6 +24,7 @@ rules: # See below for examples
|
||||||
|
|
||||||
# Modify an internal counter value (does NOT send a chat line)
|
# Modify an internal counter value (does NOT send a chat line)
|
||||||
- counter: "counterid" # String to identify the counter, applies templating
|
- counter: "counterid" # String to identify the counter, applies templating
|
||||||
|
counter_set: 25 # Integer, set counter to value (counter_step is ignored if set)
|
||||||
counter_step: 1 # Integer, can be negative or positive, default: +1
|
counter_step: 1 # Integer, can be negative or positive, default: +1
|
||||||
|
|
||||||
# Issue a delete on the message caught
|
# Issue a delete on the message caught
|
||||||
|
|
Loading…
Reference in a new issue