!version cmd added.
This commit is contained in:
parent
e05446aa34
commit
3982d4e877
24
main.go
24
main.go
|
@ -48,6 +48,7 @@ func main() {
|
||||||
//bot := ircx.Classic(*server, *name)
|
//bot := ircx.Classic(*server, *name)
|
||||||
cfg := ircx.Config{User: *name, MaxRetries: 1000}
|
cfg := ircx.Config{User: *name, MaxRetries: 1000}
|
||||||
bot := ircx.New(*server, *name, cfg)
|
bot := ircx.New(*server, *name, cfg)
|
||||||
|
log.Printf("%s started", SoftwareInfo())
|
||||||
log.Println("Logging in")
|
log.Println("Logging in")
|
||||||
if err := bot.Connect(); err != nil {
|
if err := bot.Connect(); err != nil {
|
||||||
log.Panicln("Unable to dial IRC Server:", err)
|
log.Panicln("Unable to dial IRC Server:", err)
|
||||||
|
@ -124,10 +125,8 @@ func ConnectHandler(s ircx.Sender, m *irc.Message) {
|
||||||
Params: []string{ch},
|
Params: []string{ch},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
go func() {
|
time.Sleep(5 * time.Second)
|
||||||
time.Sleep(10 * time.Second)
|
sayCh <- fmt.Sprintf("%s\n*** %s", "*", SoftwareInfo())
|
||||||
sayCh <- fmt.Sprintf("%s\nflokati %s-%d", "*", version.FlokatiVersion, version.FlokatiBuild)
|
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func PingHandler(s ircx.Sender, m *irc.Message) {
|
func PingHandler(s ircx.Sender, m *irc.Message) {
|
||||||
|
@ -141,8 +140,25 @@ func PingHandler(s ircx.Sender, m *irc.Message) {
|
||||||
|
|
||||||
func PrivmsgHandler(s ircx.Sender, m *irc.Message) {
|
func PrivmsgHandler(s ircx.Sender, m *irc.Message) {
|
||||||
//TODO: implement message handler table
|
//TODO: implement message handler table
|
||||||
|
HandleMessage(m)
|
||||||
modsc.HandleMessage(m)
|
modsc.HandleMessage(m)
|
||||||
modfortune.HandleMessage(m)
|
modfortune.HandleMessage(m)
|
||||||
modstoll.HandleMessage(m)
|
modstoll.HandleMessage(m)
|
||||||
modsaytime.HandleMessage(m)
|
modsaytime.HandleMessage(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func HandleMessage(m *irc.Message) {
|
||||||
|
tok := strings.Split(m.Trailing, " ")
|
||||||
|
if len(tok) < 1 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
switch tok[0] {
|
||||||
|
case "!version":
|
||||||
|
sayCh <- fmt.Sprintf("%s\n*** %s", "*", SoftwareInfo())
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func SoftwareInfo() string {
|
||||||
|
return fmt.Sprintf("flokatirc %s-%s", version.FlokatiVersion, version.FlokatiBuild)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue