Handle missing disruption messages

This commit is contained in:
Dimitri Lozeve 2022-09-10 21:34:36 +02:00
parent 9c46c0c552
commit f2defe4ad7

View file

@ -122,10 +122,13 @@
(unless (null? disruptions) (unless (null? disruptions)
(displayln "Perturbations :")) (displayln "Perturbations :"))
(for ((dis disruptions)) (for ((dis disruptions))
(let ((messages (hash-ref dis 'messages '())))
(if (eq? style 'markdown) (if (eq? style 'markdown)
(display "* ") (display "* ")
(display "• ")) (display "• "))
(displayln (hash-ref (car (hash-ref dis 'messages)) 'text)))) (if (null? messages)
(displayln "[Pas de message]")
(displayln (hash-ref (car messages) 'text))))))
(def (post-to-mattermost url text channel: (channel #f)) (def (post-to-mattermost url text channel: (channel #f))
(def data (list->hash-table `((text . ,text)))) (def data (list->hash-table `((text . ,text))))