mirror of
https://github.com/cquest/tootbot.git
synced 2024-11-27 22:11:06 +00:00
Customizable visibility of toots (public/unlisted)
This commit is contained in:
parent
13bb1b6785
commit
7d03160f43
|
@ -8,8 +8,10 @@
|
|||
# 4- instance domain (https:// is automatically added)
|
||||
# 5- max age (in days)
|
||||
# 6- footer tags to add (optional)
|
||||
# 7- delay (optional)
|
||||
# 8- visibility unlisted (if 0 or unset visibility is public, if 1 visibility is unlisted)
|
||||
|
||||
python3 tootbot.py geonym_fr geonym@amicale.net **password** test.amicale.net
|
||||
python3 tootbot.py cq94 cquest@amicale.net **password** test.amicale.net
|
||||
|
||||
python3 tootbot.py https://www.data.gouv.fr/fr/datasets/recent.atom cquest+opendata@amicale.net **password** amicale.net 2 "#dataset #opendata #datagouvfr"
|
||||
python3 tootbot.py https://www.data.gouv.fr/fr/datasets/recent.atom cquest+opendata@amicale.net **password** amicale.net 2 "#dataset #opendata #datagouvfr" 0 1
|
||||
|
|
13
tootbot.py
13
tootbot.py
|
@ -37,7 +37,7 @@ def unredir(redir):
|
|||
|
||||
|
||||
if len(sys.argv) < 4:
|
||||
print("Usage: python3 tootbot.py twitter_account mastodon_login mastodon_passwd mastodon_instance [max_days [footer_tags [delay]]]") # noqa
|
||||
print("Usage: python3 tootbot.py twitter_account mastodon_login mastodon_passwd mastodon_instance [max_days [footer_tags [delay [unlisted]]]]") # noqa
|
||||
sys.exit(1)
|
||||
|
||||
if len(sys.argv) > 4:
|
||||
|
@ -60,6 +60,11 @@ if len(sys.argv) > 7:
|
|||
else:
|
||||
delay = 0
|
||||
|
||||
if len(sys.argv) > 8 and (int(sys.argv[8]) == 1):
|
||||
mastodon_visibility = "unlisted"
|
||||
else:
|
||||
mastodon_visibility = "public"
|
||||
|
||||
source = sys.argv[1]
|
||||
mastodon = sys.argv[2]
|
||||
passwd = sys.argv[3]
|
||||
|
@ -203,7 +208,7 @@ if source[:4] == 'http':
|
|||
in_reply_to_id=None,
|
||||
media_ids=toot_media,
|
||||
sensitive=False,
|
||||
visibility='public',
|
||||
visibility=mastodon_visibility,
|
||||
spoiler_text=None)
|
||||
if "id" in toot:
|
||||
db.execute("INSERT INTO tweets VALUES ( ? , ? , ? , ? , ? )",
|
||||
|
@ -334,7 +339,7 @@ else:
|
|||
in_reply_to_id=None,
|
||||
media_ids=toot_media,
|
||||
sensitive=False,
|
||||
visibility='unlisted',
|
||||
visibility=mastodon_visibility,
|
||||
spoiler_text=None)
|
||||
except:
|
||||
print("10s delay")
|
||||
|
@ -343,7 +348,7 @@ else:
|
|||
in_reply_to_id=None,
|
||||
media_ids=toot_media,
|
||||
sensitive=False,
|
||||
visibility='unlisted',
|
||||
visibility=mastodon_visibility,
|
||||
spoiler_text=None)
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user