twitch-bot/action_ban.go

28 lines
439 B
Go
Raw Permalink Normal View History

2020-12-21 00:32:39 +00:00
package main
import (
"fmt"
"github.com/go-irc/irc"
"github.com/pkg/errors"
)
func init() {
registerAction(func(c *irc.Client, m *irc.Message, ruleDef *rule, r *ruleAction) error {
2020-12-21 00:32:39 +00:00
if r.Ban == nil {
return nil
}
return errors.Wrap(
c.WriteMessage(&irc.Message{
Command: "PRIVMSG",
Params: []string{
m.Params[0],
fmt.Sprintf("/ban %s %s", m.User, *r.Ban),
},
}),
"sending timeout",
)
})
}