all repos — paprika @ 6db4885ec5acb77b0a73fe306c42874b18e2bed3

go rewrite of taigabot

plugins/ctcp.go (view raw)

 1package plugins
 2
 3import (
 4	"strings"
 5
 6	"gopkg.in/irc.v3"
 7)
 8
 9type Ctcp struct{}
10
11func init() {
12	Register(Ctcp{})
13}
14
15func (Ctcp) Triggers() []string {
16	return []string{"\x01VERSION\x01", "\x01PING"}
17}
18
19func (Ctcp) Execute(m *irc.Message) (string, error) {
20	msg := m.Trailing()
21	if msg == "\x01VERSION\x01" {
22		return "\x01VERSION git.icyphox.sh/paprika\x01", IsNotice
23	} else if strings.HasPrefix(msg, "\x01PING") {
24		return msg, IsNotice
25	}
26
27	panic("Unreachable!")
28}