From 140c125fcc3307169cdf047bc656414dbb85f812 Mon Sep 17 00:00:00 2001 From: Anon Date: Sun, 12 Mar 2023 20:16:35 -0700 Subject: [PATCH] Corrected after_pick() logic --- src/main.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main.py b/src/main.py index 20d1057..f2ebaff 100755 --- a/src/main.py +++ b/src/main.py @@ -149,10 +149,14 @@ class YandereBot(FediBot.YandereBot): # Maybe I should remove this from the backend? def print_header_stats(self, picked): - _picked = picked.get_full_string() if picked else None - picked_profile = picked.get_post_setting()["name"] if picked else None - picked_next = self.listPictures[0].get_full_string() if self.listPictures else None - picked_next_profile = self.listPictures[0].get_post_setting()["name"] if self.listPictures else None + picked_profile, _picked, picked_next_profile, picked_next = None, None, None, None + if picked: + _picked = picked.get_full_string() + picked_profile = picked.get_post_setting()["name"] + + if self.listPictures: + picked_next = self.listPictures[0].get_full_string() + picked_next_profile = self.listPictures[0].get_post_setting()["name"] print("Profile: {} | Picked: {} | Next_Profile: {} | Next_Pick: {}".format( picked_profile, _picked, picked_next_profile, picked_next @@ -171,8 +175,11 @@ class YandereBot(FediBot.YandereBot): } def after_pick(self, picked): - self.blacklist(picked["picked"]) - self.print_header_stats(picked["picked"]) + if picked: + self.blacklist(picked["picked"]) + self.print_header_stats(picked["picked"]) + else: + self.print_header_stats(None) def post(self, picked): reinsert_image = False