make statefile configurable
This commit is contained in:
parent
734896fe93
commit
a4c2fc4b37
@ -3,6 +3,7 @@ username: SimpBot
|
||||
password: SimpQAhoy
|
||||
dimension: dimension.saintnet.tech
|
||||
domain: saintnet.tech
|
||||
statefile: statefile
|
||||
vtubers:
|
||||
- name: Ina
|
||||
channelid: UCMwGHR0BTZuLsmjY_NT5Pwg
|
||||
|
5
main.go
5
main.go
@ -17,6 +17,7 @@ var Password string
|
||||
var DimensionServer string
|
||||
var HomeserverDomain string
|
||||
var GitCommit string
|
||||
var Statefile string
|
||||
|
||||
func main() {
|
||||
viper.SetConfigName("config")
|
||||
@ -28,17 +29,19 @@ func main() {
|
||||
viper.SetConfigType("yaml")
|
||||
Homeserver = viper.GetString("homeserver")
|
||||
viper.SetDefault("domain", Homeserver)
|
||||
viper.SetDefault("statefile", "simpstate")
|
||||
Username = viper.GetString("username")
|
||||
Password = viper.GetString("password")
|
||||
DimensionServer = viper.GetString("dimension")
|
||||
HomeserverDomain = viper.GetString("domain")
|
||||
Statefile = viper.GetString("statefile")
|
||||
var vtubers []*Vtuber
|
||||
log.Println("Logging into", Homeserver, "as", Username)
|
||||
client, err := mautrix.NewClient(Homeserver, "", "")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
client.Store = NewLazyMemStore("statedata")
|
||||
client.Store = NewLazyMemStore(Statefile)
|
||||
_, err = client.Login(&mautrix.ReqLogin{
|
||||
Type: "m.login.password",
|
||||
Identifier: mautrix.UserIdentifier{Type: mautrix.IdentifierTypeUser, User: Username},
|
||||
|
Loading…
Reference in New Issue
Block a user