updated readme, added :media-only? option
This commit is contained in:
parent
08c66f6c1f
commit
d9be88305c
2 changed files with 12 additions and 5 deletions
|
@ -24,6 +24,9 @@ If you get a [permission failure](https://github.com/anmonteiro/lumo/issues/206)
|
||||||
* create a Tumblr API key following the instructions [here](http://www.developerdrive.com/2014/05/how-to-get-started-with-the-tumblr-api-part-1/)
|
* create a Tumblr API key following the instructions [here](http://www.developerdrive.com/2014/05/how-to-get-started-with-the-tumblr-api-part-1/)
|
||||||
* create a file called `config.edn` with the following contents:
|
* create a file called `config.edn` with the following contents:
|
||||||
|
|
||||||
|
**NOTE**: the bot checks the specified Mastodon account to see the timestamp of the last post, and only posts content
|
||||||
|
with later timestamps to avoid duplicate posts. On the first run the timestamp will default to current time.
|
||||||
|
|
||||||
```clojure
|
```clojure
|
||||||
{;; add Twitter config to mirror Twitter accounts
|
{;; add Twitter config to mirror Twitter accounts
|
||||||
:twitter {:access-keys
|
:twitter {:access-keys
|
||||||
|
@ -52,7 +55,10 @@ If you get a [permission failure](https://github.com/anmonteiro/lumo/issues/206)
|
||||||
:mastodon {:access_token "XXXX"
|
:mastodon {:access_token "XXXX"
|
||||||
:api_url "https://botsin.space/api/v1/"
|
:api_url "https://botsin.space/api/v1/"
|
||||||
;; optional boolean to mark content as sensitive
|
;; optional boolean to mark content as sensitive
|
||||||
:sensitive true
|
:sensitive? true
|
||||||
|
;; optional boolean defaults to false
|
||||||
|
;; only sources containing media will be posted when set to true
|
||||||
|
:media-only? true
|
||||||
;; optional visibility flag: direct, private, unlisted, public
|
;; optional visibility flag: direct, private, unlisted, public
|
||||||
;; defaults to public
|
;; defaults to public
|
||||||
:visibility "unlisted"
|
:visibility "unlisted"
|
||||||
|
|
|
@ -95,11 +95,11 @@
|
||||||
([status-text]
|
([status-text]
|
||||||
(post-status status-text nil))
|
(post-status status-text nil))
|
||||||
([status-text media-ids]
|
([status-text media-ids]
|
||||||
(let [{:keys [sensitive signature visibility]} mastodon-config]
|
(let [{:keys [sensitive? signature visibility]} mastodon-config]
|
||||||
(.post mastodon-client "statuses"
|
(.post mastodon-client "statuses"
|
||||||
(clj->js (merge {:status (-> status-text resolve-urls set-signature)}
|
(clj->js (merge {:status (-> status-text resolve-urls set-signature)}
|
||||||
(when media-ids {:media_ids media-ids})
|
(when media-ids {:media_ids media-ids})
|
||||||
(when sensitive {:sensitive sensitive})
|
(when sensitive? {:sensitive sensitive?})
|
||||||
(when visibility {:visibility visibility})))))))
|
(when visibility {:visibility visibility})))))))
|
||||||
|
|
||||||
(defn post-image [image-stream description callback]
|
(defn post-image [image-stream description callback]
|
||||||
|
@ -127,7 +127,8 @@
|
||||||
(filter #(> (:created-at %) last-post-time)))]
|
(filter #(> (:created-at %) last-post-time)))]
|
||||||
(if media-links
|
(if media-links
|
||||||
(post-status-with-images text media-links)
|
(post-status-with-images text media-links)
|
||||||
(post-status text))))
|
(when-not (:media-only? mastodon-config)
|
||||||
|
(post-status text)))))
|
||||||
|
|
||||||
(defn parse-tweet [{created-at :created_at
|
(defn parse-tweet [{created-at :created_at
|
||||||
text :full_text
|
text :full_text
|
||||||
|
|
Reference in a new issue