mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-10 01:00:05 +00:00
29 lines
563 B
Go
29 lines
563 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
|
|
}
|
|
|
|
counterName, err := formatMessage(*r.Counter, m, ruleDef, nil)
|
|
if err != nil {
|
|
return errors.Wrap(err, "preparing response")
|
|
}
|
|
|
|
var counterStep int64 = 1
|
|
if r.CounterStep != nil {
|
|
counterStep = *r.CounterStep
|
|
}
|
|
|
|
return errors.Wrap(
|
|
store.UpdateCounter(counterName, counterStep, false),
|
|
"update counter",
|
|
)
|
|
})
|
|
}
|