forked from an/flokati
test
This commit is contained in:
parent
d128cc7491
commit
2215d331e4
10
main.go
10
main.go
|
@ -27,24 +27,20 @@ var (
|
|||
token = flag.String("token", "", "Login token")
|
||||
)
|
||||
|
||||
var (
|
||||
sayCh chan string
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.Parse()
|
||||
}
|
||||
|
||||
func main() {
|
||||
sayCh := make(chan string, 1024)
|
||||
say := make(chan string, 1024)
|
||||
xlog.Info("%s started", SoftwareInfo())
|
||||
modules.Init(sayCh, *mods)
|
||||
modules.Init(say, *mods)
|
||||
modules.BotNick = strings.ToLower(*nick)
|
||||
switch *protocol {
|
||||
//case "irc":
|
||||
// Irc()
|
||||
case "matrix":
|
||||
Matrix()
|
||||
Matrix(say)
|
||||
default:
|
||||
xlog.Error("Unsupported protocol: %s", *protocol)
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
"github.com/matrix-org/gomatrix"
|
||||
)
|
||||
|
||||
func Matrix() {
|
||||
func Matrix(say chan string) {
|
||||
cl, err := gomatrix.NewClient(*server, *name, *token)
|
||||
fmt.Println(err)
|
||||
|
||||
|
@ -40,11 +40,11 @@ func Matrix() {
|
|||
}
|
||||
}()
|
||||
|
||||
sayCh <- fmt.Sprintf("%s\n%s", "*", SoftwareInfo())
|
||||
say <- fmt.Sprintf("%s\n%s", "*", SoftwareInfo())
|
||||
|
||||
for {
|
||||
var targets string
|
||||
line := strings.Split(<-sayCh, "\n")
|
||||
line := strings.Split(<-say, "\n")
|
||||
if len(line) < 2 {
|
||||
continue
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue