|
@@ -39,7 +39,7 @@ def megafono():
|
|
|
last_id = 0
|
|
|
with open(last_id_file) as f:
|
|
|
last_id = int(f.read())
|
|
|
- with open(ANNOUNCEMENT_FILE, 'r', encoding='utf8') as a:
|
|
|
+ with open(ANNOUNCEMENT_FILE, 'r') as a:
|
|
|
toot = a.readlines()[last_id]
|
|
|
with open(ANNOUNCEMENT_FILE, 'r') as a:
|
|
|
length = len(a.readlines())
|
|
@@ -47,8 +47,13 @@ def megafono():
|
|
|
last_id %= length
|
|
|
with open(last_id_file, 'w+') as f:
|
|
|
f.write(str(last_id))
|
|
|
- mastodon.status_post(toot.replace('\\n','\n'), visibility='unlisted')
|
|
|
- print("Sent: "+str(toot))
|
|
|
+
|
|
|
+ if toot.startswith('IMG='):
|
|
|
+ msg = toot.split(' ', 1)
|
|
|
+ img = mastodon.media_post(msg[0].split('=')[1], "image/jpeg")
|
|
|
+ mastodon.status_post(msg[1].replace('\\n','\n'), media_ids=img['id'], visibility='unlisted')
|
|
|
+ else:
|
|
|
+ mastodon.status_post(toot.replace('\\n','\n'), visibility='unlisted')
|
|
|
|
|
|
|
|
|
megafono()
|