added user abort handling

This commit is contained in:
ava fox 2020-09-09 14:16:24 -04:00
parent 453a82d81d
commit f63c968a93
3 changed files with 12 additions and 6 deletions

View File

@ -6,7 +6,7 @@
:license "NPLv1+"
:version "0.0.1"
:serial t
:depends-on (#:glacier)
:depends-on (#:glacier #:with-user-abort)
:components ((:file "package")
(:file "out-of-touch-bot"))
:entry-point "out-of-touch-bot:main"

View File

@ -6,7 +6,13 @@
(unless (uiop:file-exists-p "video.mp4")
(format t "wha- where's the out of touch thursdays video? ;w;")
(uiop:quit 1))
(run-bot ((make-instance 'mastodon-bot :config-file "config.file")
:with-websocket nil)
(on (:thursday :at "11:00")
(post "its out of touch thursdays!" :visibility :public :media "video.mp4"))))
(handler-case
(with-user-abort
(run-bot ((make-instance 'mastodon-bot :config-file "config.file")
:with-websocket nil)
(on (:thursday :at "11:00")
(post "its out of touch thursdays!" :visibility :public :media "video.mp4"))))
(user-abort ()
(uiop:quit))
(error (e)
(format t "error: ~a~%" e))))

View File

@ -1,5 +1,5 @@
;;;; package.lisp
(defpackage #:out-of-touch-bot
(:use #:cl #:glacier)
(:use #:cl #:glacier #:with-user-abort)
(:export :main))