From 2215d331e44bac55b814e3df05c009b92aebe2f8 Mon Sep 17 00:00:00 2001 From: Andreas Neue Date: Thu, 1 Aug 2019 12:58:44 +0200 Subject: [PATCH] test --- main.go | 10 +++------- matrix.go | 6 +++--- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/main.go b/main.go index 3a06ea2..8f373a5 100644 --- a/main.go +++ b/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) } diff --git a/matrix.go b/matrix.go index 1c282ce..bc8376c 100644 --- a/matrix.go +++ b/matrix.go @@ -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 }