all repos — paprika @ 03ab5c9c09a15271cea0684189e708fe07754137

go rewrite of taigabot

plugins/location.go (view raw)

 1package plugins
 2
 3import (
 4	"fmt"
 5	"strings"
 6
 7	"gopkg.in/irc.v3"
 8)
 9
10func init() {
11	Register(Location{})
12}
13
14type Location struct{}
15
16func (Location) Triggers() []string {
17	return []string{".loc", ".location"}
18}
19
20func (Location) Execute(m *irc.Message) (string, error) {
21	parsed := strings.SplitN(m.Trailing(), " ", 2)
22	trigger := parsed[0]
23	location := parsed[1]
24	if len(parsed) != 2 {
25		return fmt.Sprintf("Usage: %s <location>", trigger), nil
26	}
27}