From 9ed32f147c48793e3417cc5336e806f6519e649e Mon Sep 17 00:00:00 2001 From: "dmitri.sotnikov@gmail.com" Date: Sat, 31 Mar 2018 22:12:31 -0400 Subject: [PATCH] added signature support --- README.md | 4 +++- mastodon-bot.cljs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b127e04..85b45b5 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/mastodon-bot.cljs b/mastodon-bot.cljs index 706df37..790e750 100755 --- a/mastodon-bot.cljs +++ b/mastodon-bot.cljs @@ -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]