actually save filter
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
stryan 2022-08-10 14:03:35 -04:00
parent 0eef4a7547
commit 599540b342
2 changed files with 12 additions and 2 deletions

7
.containerignore Normal file
View File

@ -0,0 +1,7 @@
.git
.gitignore
Dockerfile*
README.md
LICENSE
*.yaml
statefile

View File

@ -54,6 +54,7 @@ func main() {
var vtubers []*Vtuber var vtubers []*Vtuber
log.Println("Logging into", Homeserver, "as", Username) log.Println("Logging into", Homeserver, "as", Username)
var client *mautrix.Client var client *mautrix.Client
uid := id.NewUserID(strings.ToLower(Username), strings.ToLower(HomeserverDomain))
if Token == "" { if Token == "" {
client, err = mautrix.NewClient(Homeserver, "", "") client, err = mautrix.NewClient(Homeserver, "", "")
if err != nil { if err != nil {
@ -61,7 +62,7 @@ func main() {
} }
} else { } else {
log.Println("using token login") 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 { if err != nil {
panic(err) panic(err)
} }
@ -75,11 +76,13 @@ func main() {
}, },
} }
store := mautrix.NewAccountDataStore("simp.batch", client) store := mautrix.NewAccountDataStore("simp.batch", client)
_, err = client.CreateFilter(dataFilter) fID, err := client.CreateFilter(dataFilter)
store.SaveFilterID(uid, fID.FilterID)
if err != nil { if err != nil {
panic(err) panic(err)
} }
client.Store = store client.Store = store
if Token == "" { if Token == "" {
login_res, err := client.Login(&mautrix.ReqLogin{ login_res, err := client.Login(&mautrix.ReqLogin{
Type: "m.login.password", Type: "m.login.password",