2016-03-02 12:20:35 +00:00
|
|
|
// vi:ts=4:sts=4:sw=4:noet:tw=72
|
|
|
|
|
2016-03-02 14:07:46 +00:00
|
|
|
// this module will provide an interface to gogs
|
|
|
|
|
2016-03-02 12:20:35 +00:00
|
|
|
package modules
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
2016-03-02 14:07:46 +00:00
|
|
|
"time"
|
2016-03-02 12:20:35 +00:00
|
|
|
|
2016-03-12 12:09:25 +00:00
|
|
|
"code.dnix.de/an/xlog"
|
|
|
|
|
2016-03-02 12:20:35 +00:00
|
|
|
"github.com/sorcix/irc"
|
|
|
|
)
|
|
|
|
|
2016-03-02 14:07:46 +00:00
|
|
|
var (
|
|
|
|
gogsAPIKey string
|
|
|
|
)
|
|
|
|
|
2016-03-02 12:20:35 +00:00
|
|
|
func init() {
|
|
|
|
MsgHandlers["fuzzytime"] = gogsHandleMessage
|
2016-03-12 12:09:25 +00:00
|
|
|
xlog.Info("Gogs module initialized")
|
2016-03-02 12:20:35 +00:00
|
|
|
}
|
|
|
|
|
2016-03-02 14:07:46 +00:00
|
|
|
func gogsConfig() {
|
|
|
|
time.Sleep(5 * time.Second)
|
|
|
|
gogsAPIKey = ModParams["gogs-api-key"]
|
|
|
|
}
|
|
|
|
|
2016-03-02 12:20:35 +00:00
|
|
|
func gogsHandleMessage(m *irc.Message) {
|
|
|
|
tok := strings.Split(m.Trailing, " ")
|
|
|
|
if len(tok) < 1 {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
switch tok[0] {
|
|
|
|
case "!gogs":
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
}
|