forked from an/flokati
34 lines
554 B
Go
34 lines
554 B
Go
|
// vi:ts=4:sts=4:sw=4:noet:tw=72
|
||
|
//
|
||
|
// flokatirc
|
||
|
//
|
||
|
// Copyright (c) 2015,2016 Andreas Neue <an@dnix.de>
|
||
|
|
||
|
package modules
|
||
|
|
||
|
import (
|
||
|
"strings"
|
||
|
|
||
|
"github.com/sorcix/irc"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
SayCh chan string
|
||
|
MsgHandlers = make(map[string]func(*irc.Message))
|
||
|
ModParams = make(map[string]string)
|
||
|
)
|
||
|
|
||
|
func Init(ch chan string, params string) {
|
||
|
SayCh = ch
|
||
|
for _, param := range strings.Split(params, "!") {
|
||
|
kv := strings.Split(param, ":")
|
||
|
ModParams[kv[0]] = kv[1]
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func HandleMessage(m *irc.Message) {
|
||
|
for _, fn := range MsgHandlers {
|
||
|
fn(m)
|
||
|
}
|
||
|
}
|