twitch-bot/action_counter.go
Knut Ahlers cad3f982cd
Simplify function definitions
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2020-12-25 19:31:07 +01:00

25 lines
425 B
Go

package main
import (
"github.com/go-irc/irc"
"github.com/pkg/errors"
)
func init() {
registerAction(func(c *irc.Client, m *irc.Message, ruleDef *rule, r *ruleAction) error {
if r.Counter == nil {
return nil
}
var counterStep int64 = 1
if r.CounterStep != nil {
counterStep = *r.CounterStep
}
return errors.Wrap(
store.UpdateCounter(*r.Counter, counterStep, false),
"update counter",
)
})
}