don't log self messages
continuous-integration/drone/push Build is passing Details

This commit is contained in:
stryan 2021-08-23 19:55:54 -04:00
parent 47c9142763
commit df73a5fa9e
1 changed files with 3 additions and 3 deletions

View File

@ -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