From 599540b34244b48156ef89c977184d4d79b01ed0 Mon Sep 17 00:00:00 2001 From: Steve Date: Wed, 10 Aug 2022 14:03:35 -0400 Subject: [PATCH] actually save filter --- .containerignore | 7 +++++++ main.go | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 .containerignore diff --git a/.containerignore b/.containerignore new file mode 100644 index 0000000..40c589d --- /dev/null +++ b/.containerignore @@ -0,0 +1,7 @@ +.git +.gitignore +Dockerfile* +README.md +LICENSE +*.yaml +statefile diff --git a/main.go b/main.go index ab2d671..9dc8c34 100644 --- a/main.go +++ b/main.go @@ -54,6 +54,7 @@ func main() { var vtubers []*Vtuber log.Println("Logging into", Homeserver, "as", Username) var client *mautrix.Client + uid := id.NewUserID(strings.ToLower(Username), strings.ToLower(HomeserverDomain)) if Token == "" { client, err = mautrix.NewClient(Homeserver, "", "") if err != nil { @@ -61,7 +62,7 @@ func main() { } } else { log.Println("using token login") - client, err = mautrix.NewClient(Homeserver, id.NewUserID(Username, HomeserverDomain), Token) + client, err = mautrix.NewClient(Homeserver, uid, Token) if err != nil { panic(err) } @@ -75,11 +76,13 @@ func main() { }, } store := mautrix.NewAccountDataStore("simp.batch", client) - _, err = client.CreateFilter(dataFilter) + fID, err := client.CreateFilter(dataFilter) + store.SaveFilterID(uid, fID.FilterID) if err != nil { panic(err) } client.Store = store + if Token == "" { login_res, err := client.Login(&mautrix.ReqLogin{ Type: "m.login.password",