diff --git a/matrix.go b/matrix.go index ece3fe8..ecccda8 100644 --- a/matrix.go +++ b/matrix.go @@ -64,6 +64,7 @@ func initMatrix() { log.Printf("[Matrix] Logged in as %s", resp.UserID) syncer := client.Syncer.(*mautrix.DefaultSyncer) + client.Syncer.(mautrix.ExtensibleSyncer).OnSync(client.DontProcessOldEvents) syncer.OnEventType(event.StateMember, func(ctx context.Context, evt *event.Event) { if evt.GetStateKey() == client.UserID.String() && evt.Content.AsMember().Membership == event.MembershipInvite { if evt.RoomID.String() == configuration.matrix.room_id { @@ -140,9 +141,11 @@ func initMatrix() { } }() - log.Print("[Matrix] Running!") - err = client.Sync() - if err != nil { - log.Fatal(err) - } + go func() { + log.Print("[Matrix] Running!") + err = client.Sync() + if err != nil { + log.Fatal(err) + } + }() }