flokati/main.go

56 lines
1.1 KiB
Go
Raw Normal View History

2019-08-01 08:50:13 +00:00
// vi:ts=4:sts=4:sw=4:noet:tw=72
//
// flokatimx
//
// Copyright (c) 2015-2019 Andreas Neue <an@dnix.de>
package main
import (
"flag"
"fmt"
"runtime"
"strings"
2019-08-01 09:04:31 +00:00
"git.dnix.de/an/flokati/modules"
2019-08-01 08:50:13 +00:00
"git.dnix.de/an/xlog"
)
var (
protocol = flag.String("protocol", "", "Protocol")
mods = flag.String("mods", "", "Modules to load")
name = flag.String("name", "flokati", "Bot name")
nick = flag.String("nick", "flokati", "Nickname")
server = flag.String("server", "https://matrix.org", "Host to connect to")
channels = flag.String("chan", "", "Channels")
password = flag.String("password", "", "Login password")
token = flag.String("token", "", "Login token")
)
var (
sayCh chan string
)
func init() {
flag.Parse()
}
func main() {
xlog.Info("%s started", SoftwareInfo())
modules.Init(sayCh, *mods)
modules.BotNick = strings.ToLower(*nick)
switch *protocol {
2019-08-01 09:11:55 +00:00
//case "irc":
// Irc()
2019-08-01 08:50:13 +00:00
case "matrix":
Matrix()
default:
xlog.Error("Unsupported protocol: %s", *protocol)
}
}
func SoftwareInfo() string {
2019-08-01 09:36:35 +00:00
return fmt.Sprintf("flokati/%s %s-%s (%s) [%s]",
*protocol, Version, Build, Builddate, runtime.Version())
2019-08-01 08:50:13 +00:00
}