aboutsummaryrefslogtreecommitdiff
path: root/irc/splatbot/handler.go
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2018-10-04 19:01:51 -0700
committerChristine Dodrill <me@christine.website>2018-10-04 19:01:51 -0700
commite36f755db2198a96e2b87781f5f5432fcee092dd (patch)
tree067de16390e58ee37d4131e47c2f01f2d21c2fb6 /irc/splatbot/handler.go
parentb1b91c49e75796aefb4b14f59bfa2ce44672903e (diff)
downloadx-e36f755db2198a96e2b87781f5f5432fcee092dd.tar.xz
x-e36f755db2198a96e2b87781f5f5432fcee092dd.zip
fix build
Diffstat (limited to 'irc/splatbot/handler.go')
-rw-r--r--irc/splatbot/handler.go53
1 files changed, 0 insertions, 53 deletions
diff --git a/irc/splatbot/handler.go b/irc/splatbot/handler.go
deleted file mode 100644
index 51ff843..0000000
--- a/irc/splatbot/handler.go
+++ /dev/null
@@ -1,53 +0,0 @@
-package main
-
-import (
- "encoding/json"
- "io/ioutil"
- "log"
- "net/http"
- "strings"
-
- "github.com/belak/irc"
-)
-
-func handlePrivmsg(c *irc.Client, e *irc.Event) {
- if strings.HasPrefix(e.Trailing(), "!splatoon") {
- splatoonLookup(c, e)
- }
-}
-
-func splatoonLookup(c *irc.Client, e *irc.Event) {
- resp, err := http.Get(url)
- if err != nil {
- c.Reply(e, "Couldn't look up splatoon maps: %s", err.Error())
- return
- }
-
- body, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- c.Reply(e, "Couldn't look up splatoon maps: %s", err.Error())
- return
- }
-
- defer resp.Body.Close()
-
- var sd []SplatoonData
- err = json.Unmarshal(body, &sd)
- if err != nil {
- c.Reply(e, "Couldn't look up splatoon maps: %s", err.Error())
- return
- }
-
- data := sd[0]
-
- stage1 := data.Stages[0]
- stage2 := data.Stages[1]
- c.Reply(
- e,
- "From %s to %s, the stage rotation is %s and %s",
- data.DatetimeTermBegin, data.DatetimeTermEnd,
- englishIfy(stage1), englishIfy(stage2),
- )
-
- log.Printf("%s asked me to look up data", e.Identity.Nick)
-}