From df73a5fa9e0a3f2a5ccda83383389c7e7602fc37 Mon Sep 17 00:00:00 2001 From: Steve Date: Mon, 23 Aug 2021 19:55:54 -0400 Subject: [PATCH] don't log self messages --- main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 9137305..ae54f82 100644 --- a/main.go +++ b/main.go @@ -59,6 +59,9 @@ func main() { fmt.Println("Login successful") syncer := client.Syncer.(*mautrix.DefaultSyncer) syncer.OnEventType(event.EventMessage, func(source mautrix.EventSource, evt *event.Event) { + if evt.Sender == client.UserID { + return //ignore events from self + } fmt.Printf("<%[1]s> %[4]s (%[2]s/%[3]s)\n", evt.Sender, evt.Type.String(), evt.ID, evt.Content.AsMessage().Body) body := evt.Content.AsMessage().Body body_s := strings.Split(body, " ") @@ -68,9 +71,6 @@ func main() { if len(body_s) < 2 { return //nothing to parse } - if evt.Sender == client.UserID { - return //ignore events from self - } switch body_s[1] { case "info": // print info page