Added module configuration params: -params=<key>:<val>(!<key>:<val>])*

This commit is contained in:
Andreas Neue
2016-02-16 07:57:14 +01:00
parent 5f2dd41d55
commit 44ee1cf628
10 changed files with 67 additions and 55 deletions
+5 -5
View File
@@ -136,7 +136,7 @@ var (
)
func init() {
msgHandlers["twitch"] = twitchHandleMessage
MsgHandlers["twitch"] = twitchHandleMessage
log.Println("Initializing twitch module")
go pollStreamData()
}
@@ -165,7 +165,7 @@ func twitchHandleMessage(m *irc.Message) {
}
}
if onlinestreams == 0 {
sayCh <- fmt.Sprintf("*\n%s", "[TWTCH] All streams offline")
SayCh <- fmt.Sprintf("*\n%s", "[TWTCH] All streams offline")
}
case 2:
streamname := tok[1]
@@ -176,7 +176,7 @@ func twitchHandleMessage(m *irc.Message) {
co = getTwitchChannelObject(streamname)
twitchSendMsg(co, so)
} else {
sayCh <- fmt.Sprintf("*\n%s", "[TWTCH] "+streamname+" not found or offline")
SayCh <- fmt.Sprintf("*\n%s", "[TWTCH] "+streamname+" not found or offline")
}
default:
}
@@ -242,6 +242,6 @@ func getTwitchChannelObject(streamname string) TwitchChannelObject {
}
func twitchSendMsg(tcobj TwitchChannelObject, tso TwitchStreamObject) {
sayCh <- fmt.Sprintf("*\n%s", "[TWTCH] "+tso.Stream.Channel.DisplayName+", "+util.NumberToString(tso.Stream.Viewers, '.')+" viewers, playing: "+tso.Stream.Game+", "+tcobj.URL)
sayCh <- fmt.Sprintf("*\n%s", "[TWTCH] "+"Title: \""+tcobj.Status+"\"")
SayCh <- fmt.Sprintf("*\n%s", "[TWTCH] "+tso.Stream.Channel.DisplayName+", "+util.NumberToString(tso.Stream.Viewers, '.')+" viewers, playing: "+tso.Stream.Game+", "+tcobj.URL)
SayCh <- fmt.Sprintf("*\n%s", "[TWTCH] "+"Title: \""+tcobj.Status+"\"")
}