From c4d44e741a9107885b3b8de4cb9c0f89792b419b Mon Sep 17 00:00:00 2001 From: retoor Date: Mon, 2 Dec 2024 13:09:48 +0100 Subject: [PATCH] Fixed caching bug. --- src/ragnar/bot.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ragnar/bot.py b/src/ragnar/bot.py index 1d00e33..cd80c32 100644 --- a/src/ragnar/bot.py +++ b/src/ragnar/bot.py @@ -126,12 +126,13 @@ class Bot: if rant["id"] in self.rant_history: log.debug("{}: Already checked rant {}.".format(self.name, rant["id"])) continue - else: - self.rant_history.append(rant["id"]) + + if not self.is_user_sus(rant["user_username"]): log.info( "{}: User {} is trusted.".format(self.name, rant["user_username"]) ) + self.rant_history.append(rant["id"]) continue elif self.is_comments_sus(rant["id"]): @@ -144,6 +145,7 @@ class Bot: ) continue if self.is_flagged_as_sus(rant["id"], rant.get("num_comments")): + self.rant_history.append(rant["id"]) continue log.warning( "{}: Rant is not {} flagged as sus yet.".format( @@ -157,7 +159,8 @@ class Bot: ) self.mark_as_sus(rant) self.down_vote_rant(rant) - + self.rant_history.append(rant["id"]) + def down_vote_rant(self, rant): log.warning("Downvoting rant by {}.".format(rant["user_username"])) log.debug(json.loads(self.api.post_rant_vote(rant["id"], -1)))