tome_matrix/main.go
2021-11-30 13:06:31 -05:00

39 lines
913 B
Go

package main
import (
"log"
"github.com/spf13/viper"
"maunium.net/go/mautrix/id"
)
func main() {
viper.AddConfigPath(".")
err := viper.ReadInConfig()
if err != nil {
log.Fatalf("Fatal error config file: %v \n", err)
}
viper.SetConfigType("yaml")
homeserver := viper.GetString("homeserver")
homeserverDomain := viper.GetString("homeserverDomain")
viper.SetDefault("domain", homeserver)
username := viper.GetString("username")
password := viper.GetString("password")
dealer := &Dealer{
RoomsList: make(map[id.RoomID]*Match),
PlayerRooms: make(map[id.UserID]id.RoomID),
Client: nil,
HomeserverDomain: homeserverDomain,
QueueRoom: "",
}
dealer.ConnectToMatrix(homeserver, username, password)
//create room #tomequeue:homeserver
dealer.SetupRooms(homeserverDomain)
dealer.RegisterHandlers()
err = dealer.Client.Sync()
if err != nil {
panic(err)
}
}