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,7 +81,10 @@ 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
@ -105,9 +108,15 @@ class Bot:
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.")
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"Can't register user {username} as spammer. User is trusted.",
)
if len(mentions) > 1:
return False
log.info(f"Trigger {trigger} matched!")
@ -147,8 +156,8 @@ 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'])
if comment["user_username"] == spammer:
vic.downvote_comment(comment["id"])
return False
print("Checking if sus comment: ", comment["body"])
@ -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"]