From 19685ed4e8dd17af187a37d3c722a3eb532da218 Mon Sep 17 00:00:00 2001 From: Oloturia Date: Mon, 6 Jun 2022 15:57:05 +0200 Subject: [PATCH] removes file after post --- mastodon_main.py | 1 + telegram_main.py | 1 + twitter_main.py | 2 ++ 3 files changed, 4 insertions(+) diff --git a/mastodon_main.py b/mastodon_main.py index fbdfc14..b24bafd 100755 --- a/mastodon_main.py +++ b/mastodon_main.py @@ -25,6 +25,7 @@ def publishStrip(altProfile=False,user=False): mastodon.status_post(config["text"],media_ids=new_strip) else: mastodon.status_post(user+" "+config["text"],media_ids=new_strip,visibility="direct") + os.remove(config["saveLocation"]+config["filename"] published = True except: continue diff --git a/telegram_main.py b/telegram_main.py index 17e3f2f..12dbee4 100755 --- a/telegram_main.py +++ b/telegram_main.py @@ -15,6 +15,7 @@ def newStrip(bot, update, args): strip_file=open(config["saveLocation"]+config["filename"],"rb") bot.send_photo(chat_id=update.message.chat_id,photo=strip_file) strip_file.close() + os.remove(config["saveLocation"]+config["filename"]) except Exception as err: print(err) else: diff --git a/twitter_main.py b/twitter_main.py index 251c432..588b866 100755 --- a/twitter_main.py +++ b/twitter_main.py @@ -27,9 +27,11 @@ if __name__ == "__main__": api.verify_credentials() api.update_with_media(config["saveLocation"]+config["filename"],config["text"]) published = True + os.remove(config["saveLocation"]+config["filename"] except: continue break + if not(published): print("Auth error") else: