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:
parent
4320babfa6
commit
b5fa938a85
7
main.go
7
main.go
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user