Browse Source

removes file after post

Oloturia 1 year ago
parent
commit
19685ed4e8
3 changed files with 4 additions and 0 deletions
  1. 1 0
      mastodon_main.py
  2. 1 0
      telegram_main.py
  3. 2 0
      twitter_main.py

+ 1 - 0
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

+ 1 - 0
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:

+ 2 - 0
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: