9
0
mirror of https://github.com/Lomanic/presence-button-web synced 2024-11-22 21:47:29 +00:00

Send a different closing message on matrix if the space was not officially opened

This commit is contained in:
Lomanic 2021-09-25 18:51:34 +02:00
parent 4320babfa6
commit b5fa938a85

View File

@ -130,9 +130,12 @@ func checkClosure() {
for { for {
if status.LastSeen.Add(defaultClosingTimeout).Before(time.Now()) && status.LastClosed.Before(status.LastSeen) { if status.LastSeen.Add(defaultClosingTimeout).Before(time.Now()) && status.LastClosed.Before(status.LastSeen) {
// the Fuz is newly closed, notify on matrix and write file to survive reboot // the Fuz is newly closed, notify on matrix and write file to survive reboot
// TODO: matrix msg
fmt.Println("the Fuz is newly closed, notify on matrix and write file to survive reboot") fmt.Println("the Fuz is newly closed, notify on matrix and write file to survive reboot")
_, err := matrix.SendText(config.MATRIXROOM, config.MATRIXCLOSINGMESSAGE) msg := config.MATRIXCLOSINGMESSAGE
if !status.FuzIsOpen {
msg = fmt.Sprintf("%s : passage bref", msg)
}
_, err := matrix.SendText(config.MATRIXROOM, msg)
if err != nil { if err != nil {
fmt.Println("err:", err) fmt.Println("err:", err)
time.Sleep(10 * time.Second) time.Sleep(10 * time.Second)