Fixed caching bug.
All checks were successful
Build Ragnar anti spam bot / Build (push) Successful in 1m24s

This commit is contained in:
retoor 2024-12-02 13:09:48 +01:00
parent 75f6ee13c5
commit c4d44e741a

View File

@ -126,12 +126,13 @@ class Bot:
if rant["id"] in self.rant_history: if rant["id"] in self.rant_history:
log.debug("{}: Already checked rant {}.".format(self.name, rant["id"])) log.debug("{}: Already checked rant {}.".format(self.name, rant["id"]))
continue continue
else:
self.rant_history.append(rant["id"])
if not self.is_user_sus(rant["user_username"]): if not self.is_user_sus(rant["user_username"]):
log.info( log.info(
"{}: User {} is trusted.".format(self.name, rant["user_username"]) "{}: User {} is trusted.".format(self.name, rant["user_username"])
) )
self.rant_history.append(rant["id"])
continue continue
elif self.is_comments_sus(rant["id"]): elif self.is_comments_sus(rant["id"]):
@ -144,6 +145,7 @@ class Bot:
) )
continue continue
if self.is_flagged_as_sus(rant["id"], rant.get("num_comments")): if self.is_flagged_as_sus(rant["id"], rant.get("num_comments")):
self.rant_history.append(rant["id"])
continue continue
log.warning( log.warning(
"{}: Rant is not {} flagged as sus yet.".format( "{}: Rant is not {} flagged as sus yet.".format(
@ -157,7 +159,8 @@ class Bot:
) )
self.mark_as_sus(rant) self.mark_as_sus(rant)
self.down_vote_rant(rant) self.down_vote_rant(rant)
self.rant_history.append(rant["id"])
def down_vote_rant(self, rant): def down_vote_rant(self, rant):
log.warning("Downvoting rant by {}.".format(rant["user_username"])) log.warning("Downvoting rant by {}.".format(rant["user_username"]))
log.debug(json.loads(self.api.post_rant_vote(rant["id"], -1))) log.debug(json.loads(self.api.post_rant_vote(rant["id"], -1)))