added support for status flags

This commit is contained in:
Dmitri Sotnikov 2018-08-26 00:59:43 -04:00
parent 0c2832ddf0
commit 6c3879a7fa
2 changed files with 11 additions and 5 deletions

View file

@ -51,6 +51,11 @@ If you get a [permission failure](https://github.com/anmonteiro/lumo/issues/206)
"r/Clojure" "https://www.reddit.com/r/clojure/.rss"}
:mastodon {:access_token "XXXX"
:api_url "https://botsin.space/api/v1/"
;; optional boolean to makr content as sensitive
:sensitive true
;; optional visibility flag: direct, private, unlisted, public
;; defaults to public
:visibility "unlisted"
;; optional limit for the post length
:max-post-length 300
;; optional flag specifying wether the name of the account

View file

@ -63,11 +63,12 @@
([status-text]
(post-status status-text nil))
([status-text media-ids]
(.post mastodon-client "statuses"
(clj->js (merge {:status (if-let [signature (-> config :mastodon :signature)]
(str status-text "\n" signature)
status-text)}
(when media-ids {:media_ids media-ids}))))))
(let [{:keys [sensitive signature visibility]} (:mastodon config)]
(.post mastodon-client "statuses"
(clj->js (merge {:status (if signature (str status-text "\n" signature) status-text)}
(when media-ids {:media_ids media-ids})
(when sensitive {:sensitive sensitive})
(when visibility {:visibility visibility})))))))
(defn post-image [image-stream description callback]
(-> (.post mastodon-client "media" #js {:file image-stream :description description})