Update export statistics

This commit is contained in:
bot 2025-03-05 13:11:06 +00:00
parent 0d8d436549
commit 71db74cdbb
3 changed files with 28 additions and 16 deletions

BIN
dist/ragnar-1.3.37-py3-none-any.whl vendored Normal file

Binary file not shown.

Binary file not shown.

View File

@ -81,10 +81,13 @@ class Bot:
rant = self.api.get_rant(rant_id)
for comment in rant.get("comments", []):
print("Checking if sus comment: ", comment["body"])
if comment.get("user_username") == username and comment.get("user_score") <= 10:
if (
comment.get("user_username") == username
and comment.get("user_score") <= 10
):
vic.register_spammer(comment["user_username"])
return True
return False
return False
@method_cache
def is_sus_content(self, content):
@ -101,15 +104,21 @@ class Bot:
mentions = self.get_mentions(content)
for mention in mentions:
if mention == "@ragnar":
continue
continue
username = mention.strip("@")
if self.is_comment_deletable(username):
vic.register_spammer(mention.strip("@"))
self.api.post_comment(rant_id, f"User {username} is sucessfully registered as spammer.")
else:
self.api.post_comment(rant_id, f"Can't register user {username} as spammer. User is trusted.")
self.api.post_comment(
rant_id,
f"User {username} is sucessfully registered as spammer.",
)
else:
self.api.post_comment(
rant_id,
f"Can't register user {username} as spammer. User is trusted.",
)
if len(mentions) > 1:
return False
return False
log.info(f"Trigger {trigger} matched!")
return True
return False
@ -147,9 +156,9 @@ class Bot:
rant = self.api.get_rant(rant_id)
for comment in rant.get("comments", []):
for spammer in self.sus_users:
if comment['user_username'] == spammer:
vic.downvote_comment(comment['id'])
return False
if comment["user_username"] == spammer:
vic.downvote_comment(comment["id"])
return False
print("Checking if sus comment: ", comment["body"])
if "@ragnar" in comment.get("body", "").lower():
@ -162,11 +171,11 @@ class Bot:
return True
return False
def mark_as_sus(self, rant,is_flagged_by_ai):
mark_text = self.mark_text
def mark_as_sus(self, rant, is_flagged_by_ai):
mark_text = self.mark_text
if is_flagged_by_ai:
mark_text += "\n* Flagged by AI."
self.api.post_comment(rant["id"],mark_text)
self.api.post_comment(rant["id"], mark_text)
def fight(self):
self.rsleepii()
@ -193,11 +202,14 @@ class Bot:
self.name, rant["user_username"]
)
)
if not vic.is_spam(rant['text']) >= 5:
if not vic.is_spam(rant["text"]) >= 5:
continue
else:
log.info(
"{}: Rant by {} is sus according to AI.".format(self.name, rant["user_username"]))
"{}: Rant by {} is sus according to AI.".format(
self.name, rant["user_username"]
)
)
log.warning(
"{}: Rant by {} is not flagged as sus yet but should be.".format(
self.name, rant["user_username"]
@ -208,7 +220,7 @@ class Bot:
self.name, rant["user_username"]
)
)
self.mark_as_sus(rant,flagged_by_id)
self.mark_as_sus(rant, flagged_by_id)
self.down_vote_rant(rant)
self.rant_history.append(rant["id"])