package matrixbot import ( "fmt" "maunium.net/go/mautrix" "maunium.net/go/mautrix/id" "roese.dev/matrix-development-lauge/modules/config" ) func SendMessage(header string, content string, url string) { cfg := config.Cfg.Bot client, err := mautrix.NewClient(cfg.HomeserverUrl, "", "") if err != nil { panic(err) } _, err = client.Login(&mautrix.ReqLogin{ Type: "m.login.password", Identifier: mautrix.UserIdentifier{Type: mautrix.IdentifierTypeUser, User: cfg.User}, Password: cfg.Password, StoreCredentials: true, }) if err != nil { panic(err) } //msg := format.RenderMarkdown(fmt.Sprintf("Thema: Radko-Stöckl-Schule - Aktuelles

%s

%s
%s", header, content, url), false, true) //client.SendMessageEvent(id.RoomID(cfg.RoomId), event.EventMessage, &msg) client.SendNotice(id.RoomID(cfg.RoomId), fmt.Sprintf("Thema: Radko-Stöckl-Schule - Aktuelles

%s

%s
%s", header, content, url)) }