first push

This commit is contained in:
a. fox 2023-10-05 10:25:09 -04:00
commit 160dde84f5
4 changed files with 62 additions and 0 deletions

16
README.md Normal file
View File

@ -0,0 +1,16 @@
# friday-bot
### _ava fox_
a mastodon bot that posts a short part of David Lynch's film "Rabbits" every friday at 13:00 UTC
## Usage
you need a config file at `config.file` with your mastodon tokens,
and the video at `video.mp4`
the bot will find them in the current directory and post it
## License
NPLv1+

14
friday-bot.asd Normal file
View File

@ -0,0 +1,14 @@
;;;; out-of-touch-bot.asd
(asdf:defsystem #:friday-bot
:description "don't forget, tomorrow is friday"
:author "ava fox"
:license "NPLv1+"
:version "0.0.1"
:serial t
:depends-on (#:glacier #:with-user-abort)
:components ((:file "package")
(:file "friday-bot"))
:entry-point "friday-bot:main"
:build-operation "program-op"
:build-pathname "bin/friday-bot")

27
friday-bot.lisp Normal file
View File

@ -0,0 +1,27 @@
;;;; out-of-touch-bot.lisp
(in-package #:friday-bot)
(defvar *alt-text*
"a snippet from David Lynch's film 'Rabbits'
the video shows three anthropomorphic rabbits sitting in a sparse apartment, two are sitting on a couch with the third standing behind it. the one standing behind the couch says 'do not forget today is friday', which is followed by a laugh track. all three rabbits do nothing while the laugh track plays.")
(defun main ()
(unless (uiop:file-exists-p "video.mp4")
(format t "wha- where's the video? ;w;")
(uiop:quit 1))
(handler-case
(with-user-abort
(run-bot ((make-instance 'mastodon-bot :config-file "config.file")
:with-websocket nil)
(on (:friday :at "13:00")
(post "don't forget that today is friday." :visibility :public :media
`((#P"video.mp4" ,*alt-text*))))))
(user-abort ()
(uiop:quit))
(error (e)
(with-open-file (out "error.log" :direction :output
:if-does-not-exist :create
:if-exists :overwrite)
(format out "error: ~a~%" e)))))

5
package.lisp Normal file
View File

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