mv append screen-name to transform
This commit is contained in:
parent
99014a1239
commit
64fa3120eb
4 changed files with 10 additions and 11 deletions
|
@ -60,9 +60,6 @@ with later timestamps to avoid duplicate posts. On the first run the timestamp w
|
|||
:visibility "unlisted"
|
||||
;; optional limit for the post length
|
||||
:max-post-length 300
|
||||
;; optional flag specifying wether the name of the account
|
||||
;; will be appended in the post, defaults to false
|
||||
:append-screen-name? false
|
||||
;; optionally try to resolve URLs in posts to skip URL shorteners
|
||||
;; defaults to false
|
||||
:resolve-urls? true
|
||||
|
@ -82,6 +79,9 @@ with later timestamps to avoid duplicate posts. On the first run the timestamp w
|
|||
;; accounts you wish to mirror
|
||||
:accounts ["arstechnica" "WIRED"]}
|
||||
:target {:type :mastodon-target
|
||||
;; optional flag specifying wether the name of the account
|
||||
;; will be appended in the post, defaults to false
|
||||
:append-screen-name? false
|
||||
;; optional signature for posts
|
||||
:signature "#newsbot"}}]
|
||||
}
|
||||
|
|
|
@ -29,12 +29,13 @@
|
|||
(s/def ::content-filters (s/* ::content-filter))
|
||||
(s/def ::keyword-filters (s/* ::keyword-filter))
|
||||
(def mastodon-auth? (s/keys :req-un [::account-id ::access_token ::api_url]))
|
||||
(def mastodon-target? (s/keys :req-un [
|
||||
(def mastodon-target? (s/keys :opt-un [
|
||||
;::content-filters ::keyword-filters
|
||||
;::max-post-length
|
||||
::signature
|
||||
;::visibility
|
||||
;::append-screen-name? ::sensitive? ::resolve-urls?
|
||||
::append-screen-name?
|
||||
;::sensitive? ::resolve-urls?
|
||||
;::nitter-urls? ::replacements
|
||||
]))
|
||||
(def mastodon-config? (s/merge mastodon-auth? mastodon-target?))
|
||||
|
@ -48,10 +49,6 @@
|
|||
[mastodon-config mastodon-config?]
|
||||
(mapv re-pattern (:keyword-filters mastodon-config)))
|
||||
|
||||
(defn-spec append-screen-name? ::append-screen-name?
|
||||
[mastodon-config mastodon-config?]
|
||||
(boolean (:append-screen-name? mastodon-config)))
|
||||
|
||||
(defn-spec max-post-length ::max-post-length
|
||||
[mastodon-config mastodon-config?]
|
||||
(:max-post-length mastodon-config))
|
||||
|
|
|
@ -47,15 +47,16 @@
|
|||
|
||||
:else text))
|
||||
|
||||
; TODO: move this to mastodon-api - seems to belong strongly to mastodon
|
||||
(defn-spec intermediate-to-mastodon mastodon-output?
|
||||
[mastodon-auth masto/mastodon-auth?
|
||||
target masto/mastodon-target?
|
||||
input input?]
|
||||
(let [{:keys [created-at text media-links screen_name untrimmed-text]} input
|
||||
{:keys [signature]} target
|
||||
{:keys [signature append-screen-name?]} target
|
||||
untrimmed (if (some? untrimmed-text)
|
||||
(str " " untrimmed-text) "")
|
||||
sname (if (masto/append-screen-name? mastodon-auth)
|
||||
sname (if (some? append-screen-name?)
|
||||
(str "\n#" screen_name) "")
|
||||
signature_text (if (some? signature)
|
||||
(str "\n" signature)
|
||||
|
|
|
@ -14,4 +14,5 @@
|
|||
:include-rts? true
|
||||
:accounts ["an-twitter-account"]}
|
||||
:target {:type :mastodon-target
|
||||
:append-screen-name? true
|
||||
:signature "my-bot"}}])))
|
||||
|
|
Reference in a new issue