mirror of
https://github.com/cquest/tootbot.git
synced 2024-11-23 20:11:06 +00:00
delay post only is there is an attachment
This commit is contained in:
parent
b2185b6434
commit
af8ff73fd1
36
tootbot.py
36
tootbot.py
|
@ -288,29 +288,31 @@ else:
|
||||||
if tags:
|
if tags:
|
||||||
c = c + '\n' + tags
|
c = c + '\n' + tags
|
||||||
|
|
||||||
if toot_media is not None:
|
try:
|
||||||
try:
|
if len(toot_media)>0:
|
||||||
toot = mastodon_api.status_post(c,
|
time.sleep(5)
|
||||||
|
toot = mastodon_api.status_post(c,
|
||||||
|
in_reply_to_id=None,
|
||||||
|
media_ids=toot_media,
|
||||||
|
sensitive=False,
|
||||||
|
visibility='unlisted',
|
||||||
|
spoiler_text=None)
|
||||||
|
except:
|
||||||
|
print("10s delay")
|
||||||
|
time.sleep(10)
|
||||||
|
toot = mastodon_api.status_post(c,
|
||||||
in_reply_to_id=None,
|
in_reply_to_id=None,
|
||||||
media_ids=toot_media,
|
media_ids=toot_media,
|
||||||
sensitive=False,
|
sensitive=False,
|
||||||
visibility='unlisted',
|
visibility='unlisted',
|
||||||
spoiler_text=None)
|
spoiler_text=None)
|
||||||
except:
|
pass
|
||||||
print("10s delay")
|
|
||||||
time.sleep(10)
|
|
||||||
toot = mastodon_api.status_post(c,
|
|
||||||
in_reply_to_id=None,
|
|
||||||
media_ids=toot_media,
|
|
||||||
sensitive=False,
|
|
||||||
visibility='unlisted',
|
|
||||||
spoiler_text=None)
|
|
||||||
pass
|
|
||||||
|
|
||||||
#break
|
#break
|
||||||
if "id" in toot:
|
if "id" in toot:
|
||||||
db.execute("INSERT INTO tweets VALUES ( ? , ? , ? , ? , ? )", (id, toot["id"], source, mastodon, instance))
|
db.execute("INSERT INTO tweets VALUES ( ? , ? , ? , ? , ? )", (id, toot["id"], source, mastodon, instance))
|
||||||
sql.commit()
|
sql.commit()
|
||||||
|
print(source, ": tweet created at",t['created_at'])
|
||||||
|
|
||||||
print("---------------------------")
|
print("---------------------------")
|
||||||
print()
|
print()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user