added signature support

This commit is contained in:
dmitri.sotnikov@gmail.com 2018-03-31 22:12:31 -04:00
parent bf38e75b1a
commit 9ed32f147c
2 changed files with 6 additions and 2 deletions

View file

@ -35,7 +35,9 @@ the bot will post the timeline from the specified Twitter/Tumblr accounts and RS
"r/Clojure" "https://www.reddit.com/r/clojure/.rss"}
:mastodon {:access_token "XXXX"
:api_url "https://botsin.space/api/v1/"
:max-post-length 300}}
:max-post-length 300
;; optional signature for posts
:signature "#newsbot"}}
```
* the bot looks for `config.edn` at its relative path by default, an alternative location can be specified either using the `MASTODON_BOT_CONFIG` environment variable or passing the path to config as an argument

View file

@ -49,7 +49,9 @@
(post-status status-text nil))
([status-text media-ids]
(.post mastodon-client "statuses"
(clj->js (merge {:status status-text}
(clj->js (merge {:status (if-let [signature (-> config :mastodon :signature)]
(str status-text "\n" signature)
status-text)}
(when media-ids {:media_ids media-ids}))))))
(defn post-image [image-stream description callback]