Updated per backend change

This commit is contained in:
Anon 2023-03-19 19:29:02 -07:00
parent 9ea32b8747
commit bd2148b5c1

View File

@ -181,13 +181,16 @@ class YandereBot(FediBot.YandereBot):
else:
self.print_header_stats(None)
def post(self, picked):
def post(self, callback=None):
picked = None
reinsert_image = False
try:
return super(YandereBot, self).post(picked)
picked = self.pick()
return super(YandereBot, self).post(lambda: picked)
# Attempted to post a file that doesn't exist (immediately repost ignoring retry_seconds)
except (FileNotFoundError, FediBot.InvalidPost):
print("File not found:", picked["picked"].get_hash_path())
if picked:
print("File not found:", picked["picked"].get_hash_path())
reinsert_image = False
# Check if the file limit has been reached
@ -211,7 +214,7 @@ class YandereBot(FediBot.YandereBot):
# Exception flags
reinsert_image = True
if reinsert_image and self.consecutive_failed_uploads < self.settings["settings_behavior"]["max_errors"]:
if picked and reinsert_image and self.consecutive_failed_uploads < self.settings["settings_behavior"]["max_errors"]:
self.listPictures.insert(0, picked["picked"])
self.handle_post_exception()