2021-11-27 17:13:27 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"github.com/spf13/viper"
|
2021-11-28 18:55:39 -05:00
|
|
|
"maunium.net/go/mautrix/id"
|
2021-11-27 17:13:27 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
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")
|
2021-11-28 18:55:39 -05:00
|
|
|
homeserverDomain := viper.GetString("homeserverDomain")
|
2021-11-27 17:13:27 -05:00
|
|
|
viper.SetDefault("domain", homeserver)
|
|
|
|
username := viper.GetString("username")
|
|
|
|
password := viper.GetString("password")
|
|
|
|
|
|
|
|
dealer := &Dealer{
|
2021-11-28 18:55:39 -05:00
|
|
|
RoomsList: make(map[id.RoomID]*Match),
|
|
|
|
PlayerRooms: make(map[id.UserID]id.RoomID),
|
|
|
|
Client: nil,
|
|
|
|
HomeserverDomain: homeserverDomain,
|
|
|
|
QueueRoom: "",
|
2021-11-27 17:13:27 -05:00
|
|
|
}
|
|
|
|
dealer.ConnectToMatrix(homeserver, username, password)
|
2021-11-28 18:55:39 -05:00
|
|
|
//create room #tomequeue:homeserver
|
|
|
|
dealer.SetupRooms(homeserverDomain)
|
2021-11-30 13:06:31 -05:00
|
|
|
dealer.RegisterHandlers()
|
2021-11-28 18:55:39 -05:00
|
|
|
err = dealer.Client.Sync()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2021-11-27 17:13:27 -05:00
|
|
|
}
|