Update export statistics
This commit is contained in:
parent
0d8d436549
commit
71db74cdbb
BIN
dist/ragnar-1.3.37-py3-none-any.whl
vendored
Normal file
BIN
dist/ragnar-1.3.37-py3-none-any.whl
vendored
Normal file
Binary file not shown.
BIN
dist/ragnar-1.3.37.tar.gz
vendored
BIN
dist/ragnar-1.3.37.tar.gz
vendored
Binary file not shown.
@ -81,10 +81,13 @@ class Bot:
|
|||||||
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 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"])
|
vic.register_spammer(comment["user_username"])
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@method_cache
|
@method_cache
|
||||||
def is_sus_content(self, content):
|
def is_sus_content(self, content):
|
||||||
@ -101,15 +104,21 @@ class Bot:
|
|||||||
mentions = self.get_mentions(content)
|
mentions = self.get_mentions(content)
|
||||||
for mention in mentions:
|
for mention in mentions:
|
||||||
if mention == "@ragnar":
|
if mention == "@ragnar":
|
||||||
continue
|
continue
|
||||||
username = mention.strip("@")
|
username = mention.strip("@")
|
||||||
if self.is_comment_deletable(username):
|
if self.is_comment_deletable(username):
|
||||||
vic.register_spammer(mention.strip("@"))
|
vic.register_spammer(mention.strip("@"))
|
||||||
self.api.post_comment(rant_id, f"User {username} is sucessfully registered as spammer.")
|
self.api.post_comment(
|
||||||
else:
|
rant_id,
|
||||||
self.api.post_comment(rant_id, f"Can't register user {username} as spammer. User is trusted.")
|
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:
|
if len(mentions) > 1:
|
||||||
return False
|
return False
|
||||||
log.info(f"Trigger {trigger} matched!")
|
log.info(f"Trigger {trigger} matched!")
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
@ -147,9 +156,9 @@ class Bot:
|
|||||||
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", []):
|
||||||
for spammer in self.sus_users:
|
for spammer in self.sus_users:
|
||||||
if comment['user_username'] == spammer:
|
if comment["user_username"] == spammer:
|
||||||
vic.downvote_comment(comment['id'])
|
vic.downvote_comment(comment["id"])
|
||||||
return False
|
return False
|
||||||
|
|
||||||
print("Checking if sus comment: ", comment["body"])
|
print("Checking if sus comment: ", comment["body"])
|
||||||
if "@ragnar" in comment.get("body", "").lower():
|
if "@ragnar" in comment.get("body", "").lower():
|
||||||
@ -162,11 +171,11 @@ class Bot:
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def mark_as_sus(self, rant,is_flagged_by_ai):
|
def mark_as_sus(self, rant, is_flagged_by_ai):
|
||||||
mark_text = self.mark_text
|
mark_text = self.mark_text
|
||||||
if is_flagged_by_ai:
|
if is_flagged_by_ai:
|
||||||
mark_text += "\n* 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):
|
def fight(self):
|
||||||
self.rsleepii()
|
self.rsleepii()
|
||||||
@ -193,11 +202,14 @@ class Bot:
|
|||||||
self.name, rant["user_username"]
|
self.name, rant["user_username"]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if not vic.is_spam(rant['text']) >= 5:
|
if not vic.is_spam(rant["text"]) >= 5:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
log.info(
|
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(
|
log.warning(
|
||||||
"{}: Rant by {} is not flagged as sus yet but should be.".format(
|
"{}: Rant by {} is not flagged as sus yet but should be.".format(
|
||||||
self.name, rant["user_username"]
|
self.name, rant["user_username"]
|
||||||
@ -208,7 +220,7 @@ class Bot:
|
|||||||
self.name, rant["user_username"]
|
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.down_vote_rant(rant)
|
||||||
self.rant_history.append(rant["id"])
|
self.rant_history.append(rant["id"])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user