Update export statistics

This commit is contained in:
bot 2024-11-30 17:19:21 +00:00
parent 0045264250
commit c68e3b743c
6 changed files with 5 additions and 6 deletions

Binary file not shown.

Binary file not shown.

View File

@ -48,7 +48,7 @@ class Bot:
"helping", "helping",
"quality", "quality",
"unqiue", "unqiue",
"@ragnar" "@ragnar",
] ]
self.api = Api(username=self.username, password=self.password) self.api = Api(username=self.username, password=self.password)
@ -67,7 +67,7 @@ class Bot:
def clean_rant_text(self, rant_text): def clean_rant_text(self, rant_text):
return rant_text.replace(" ", "").lower() return rant_text.replace(" ", "").lower()
@method_cache @method_cache
def is_sus_content(self, content): def is_sus_content(self, content):
clean_text = self.clean_rant_text(content) clean_text = self.clean_rant_text(content)
for trigger in self.triggers: for trigger in self.triggers:
@ -113,12 +113,11 @@ class Bot:
log.info("Checking if comments are sus of rant {}.".format(rant_id)) log.info("Checking if comments are sus of rant {}.".format(rant_id))
rant = self.api.get_rant(rant_id) rant = self.api.get_rant(rant_id)
for comment in rant.get("comments", []): for comment in rant.get("comments", []):
print("Checking if sus comment: ", comment['body']) print("Checking if sus comment: ", comment["body"])
if self.is_sus_content(comment.get("body", "")): if self.is_sus_content(comment.get("body", "")):
return True return True
return False return False
def mark_as_sus(self, rant): def mark_as_sus(self, rant):
self.rsleepii() self.rsleepii()
self.api.post_comment(rant["id"], self.mark_text) self.api.post_comment(rant["id"], self.mark_text)
@ -138,7 +137,7 @@ class Bot:
) )
continue continue
elif self.is_comments_sus(rant["id"]): elif self.is_comments_sus(rant["id"]):
log.info("Comments of rant are sus + user sus. Will flag as spam.") log.info("Comments of rant are sus + user sus. Will flag as spam.")
elif not self.is_sus_rant(rant["id"], rant["text"]): elif not self.is_sus_rant(rant["id"], rant["text"]):
log.info( log.info(

View File

@ -25,4 +25,4 @@ class BotTestCase(unittest.TestCase):
def test_is_sus_content(self): def test_is_sus_content(self):
rant_text = "I completely understand the frustration—its such a hassle to manage all those details manually. I recently started using a platform called best ai trip planner https://easytrip.ai/ and its been a game-changer for my travel planning. This AI-powered service analyzes your trip requirements and gives you a comprehensive plan with the best transportation options. Whether youre looking for the fastest way to travel, the most scenic routes, or something within a specific budget, EasyTrip.ai does all the heavy lifting for you. Its also great for last-minute plans because it quickly pulls together all the available options!" rant_text = "I completely understand the frustration—its such a hassle to manage all those details manually. I recently started using a platform called best ai trip planner https://easytrip.ai/ and its been a game-changer for my travel planning. This AI-powered service analyzes your trip requirements and gives you a comprehensive plan with the best transportation options. Whether youre looking for the fastest way to travel, the most scenic routes, or something within a specific budget, EasyTrip.ai does all the heavy lifting for you. Its also great for last-minute plans because it quickly pulls together all the available options!"
self.assertTrue(self.bot.is_sus_content(rant_text)) self.assertTrue(self.bot.is_sus_content(rant_text))