swap away from lazymemstore

This commit is contained in:
stryan 2022-08-03 13:06:54 -04:00
parent 0d013bfe28
commit ba048c35da

22
main.go
View File

@ -25,11 +25,27 @@ func main() {
panic(err)
}
}
store := mbl.NewLazyMemStore(conf.Statefile)
matrixClient, err := mbl.NewMatrixClient(conf, store)
dataFilter := &mautrix.Filter{
AccountData: mautrix.FilterPart{
Limit: 20,
NotTypes: []event.Type{
event.NewEventType("nun.batch"),
},
},
}
matrixClient, err := mbl.NewMatrixClient(conf, nil)
if err != nil {
panic(err)
}
store := mautrix.NewAccountDataStore("nun.batch", matrixClient)
_, err = matrixClient.CreateFilter(dataFilter)
if err != nil {
//don't want to continue if we can't keep state
panic(err)
}
matrixClient.Store = store
syncer := matrixClient.Syncer.(*mautrix.DefaultSyncer)
mbl.AcceptAllRoomInvites(matrixClient)
syncer.OnEventType(event.EventMessage, func(source mautrix.EventSource, evt *event.Event) {
@ -43,7 +59,7 @@ func main() {
}
return
}
switch cmd[1] {
switch cmd[0] {
case "version":
// print version
if GitTag != "" {