Link weather module, changed shortcuts to "!weather" and "!wetter"

This commit is contained in:
Andreas Neue 2016-02-06 23:30:34 +01:00
parent cde6e49baa
commit 69e8ef85b1
4 changed files with 13 additions and 5 deletions

View File

@ -3,7 +3,7 @@ export GOPATH
default: build
build: test genversion genbuilddate
build: genversion genbuilddate test
go build -v flokatirc
build-win: test genversion

View File

@ -1,4 +1,5 @@
## flokatirc
*an incredibly friendly, silver-tongued, and elegantly proportioned IRC community bot*
#### LICENSE
@ -7,5 +8,5 @@ See `LICENSE` file.
#### QUICK INSTALL
`# go build flokatirc`
`# make build`

11
main.go
View File

@ -24,6 +24,7 @@ import (
modsc "flokatirc/modules/sc"
modstoll "flokatirc/modules/stoll"
modtwitch "flokatirc/modules/twitch"
modweather "flokatirc/modules/weather"
)
var (
@ -77,6 +78,9 @@ func main() {
if strings.Contains(*modules, "twitch") {
go modtwitch.Init(sayCh)
}
if strings.Contains(*modules, "weather") {
go modweather.Init(sayCh)
}
go func() {
for {
@ -130,7 +134,8 @@ func ConnectHandler(s ircx.Sender, m *irc.Message) {
})
}
time.Sleep(5 * time.Second)
sayCh <- fmt.Sprintf("%s\n\x01ACTION running on %s", "*", SoftwareInfo())
//sayCh <- fmt.Sprintf("%s\n\001ACTION running on %s", "*", SoftwareInfo())
sayCh <- fmt.Sprintf("%s\n%s", "*", SoftwareInfo())
}
func PingHandler(s ircx.Sender, m *irc.Message) {
@ -150,6 +155,7 @@ func PrivmsgHandler(s ircx.Sender, m *irc.Message) {
modstoll.HandleMessage(m)
modsaytime.HandleMessage(m)
modtwitch.HandleMessage(m)
modweather.HandleMessage(m)
}
func HandleMessage(m *irc.Message) {
@ -159,7 +165,8 @@ func HandleMessage(m *irc.Message) {
}
switch tok[0] {
case "!version":
sayCh <- fmt.Sprintf("%s\n\x01ACTION running on %s", "*", SoftwareInfo())
//sayCh <- fmt.Sprintf("%s\n\001ACTION running on %s", "*", SoftwareInfo())
sayCh <- fmt.Sprintf("%s\n%s", "*", SoftwareInfo())
default:
}
}

View File

@ -80,7 +80,7 @@ func HandleMessage(m *irc.Message) {
return
}
switch tok[0] {
case "!w":
case "!weather", "!wetter":
switch len(tok) {
case 1:
sayCh <- fmt.Sprintf("*\n%s", weatherPrefix+"Usage: !w <zip/city/state/country>")