summaryrefslogtreecommitdiff
path: root/weather.go
diff options
context:
space:
mode:
Diffstat (limited to 'weather.go')
-rw-r--r--weather.go43
1 files changed, 0 insertions, 43 deletions
diff --git a/weather.go b/weather.go
deleted file mode 100644
index 312b330..0000000
--- a/weather.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package main
-
-import (
- "fmt"
- "strings"
-
- "dim13.org/weather"
- irc "github.com/fluffle/goirc/client"
-)
-
-type Weather struct {
- Command
- lastCity map[string]string
-}
-
-func (_ Weather) WithArgs(_ int) bool { return true }
-
-func (w *Weather) Handle(conn *irc.Conn, line *irc.Line) {
- var city string
- q := strings.SplitN(line.Text(), " ", 2)
- if len(q) == 2 {
- city = q[1]
- } else if l, ok := w.lastCity[line.Nick]; ok {
- city = l
- } else {
- conn.Notice(line.Target(), "set your location first")
- return
- }
- if c, err := weather.ByCityName(city); err != nil {
- conn.Notice(line.Target(), err.Error())
- } else {
- conn.Notice(line.Target(), fmt.Sprint(c))
- w.lastCity[line.Nick] = city
- }
-}
-
-func (_ Weather) Help() string {
- return "Fetch current weather"
-}
-
-func init() {
- Register("weather", &Weather{lastCity: make(map[string]string)})
-}