all repos — paprika @ 03ab5c9c09a15271cea0684189e708fe07754137

go rewrite of taigabot

Init location plugin
Anirudh Oppiliappan x@icyphox.sh
Sat, 20 Nov 2021 09:55:10 +0530
commit

03ab5c9c09a15271cea0684189e708fe07754137

parent

9120dc31af6e8c5fd862b591f9f4efa90be347ef

1 files changed, 27 insertions(+), 0 deletions(-)

jump to
A plugins/location.go

@@ -0,0 +1,27 @@

+package plugins + +import ( + "fmt" + "strings" + + "gopkg.in/irc.v3" +) + +func init() { + Register(Location{}) +} + +type Location struct{} + +func (Location) Triggers() []string { + return []string{".loc", ".location"} +} + +func (Location) Execute(m *irc.Message) (string, error) { + parsed := strings.SplitN(m.Trailing(), " ", 2) + trigger := parsed[0] + location := parsed[1] + if len(parsed) != 2 { + return fmt.Sprintf("Usage: %s <location>", trigger), nil + } +}