This commit is contained in:
parent
0eef4a7547
commit
599540b342
7
.containerignore
Normal file
7
.containerignore
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
Dockerfile*
|
||||||
|
README.md
|
||||||
|
LICENSE
|
||||||
|
*.yaml
|
||||||
|
statefile
|
7
main.go
7
main.go
@ -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",
|
||||||
|
Loading…
Reference in New Issue
Block a user