Added AI check.
All checks were successful
Build Ragnar anti spam bot / Build (push) Successful in 3m33s
All checks were successful
Build Ragnar anti spam bot / Build (push) Successful in 3m33s
This commit is contained in:
parent
f51ac60a2e
commit
0d8d436549
@ -162,8 +162,11 @@ class Bot:
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def mark_as_sus(self, rant):
|
def mark_as_sus(self, rant,is_flagged_by_ai):
|
||||||
self.api.post_comment(rant["id"], self.mark_text)
|
mark_text = self.mark_text
|
||||||
|
if is_flagged_by_ai:
|
||||||
|
mark_text += "\n* Flagged by AI."
|
||||||
|
self.api.post_comment(rant["id"],mark_text)
|
||||||
|
|
||||||
def fight(self):
|
def fight(self):
|
||||||
self.rsleepii()
|
self.rsleepii()
|
||||||
@ -172,7 +175,7 @@ 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
|
||||||
|
flagged_by_id = False
|
||||||
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"])
|
||||||
@ -186,14 +189,17 @@ class Bot:
|
|||||||
pass
|
pass
|
||||||
elif not self.is_sus_rant(rant["id"], rant["text"]):
|
elif not self.is_sus_rant(rant["id"], rant["text"]):
|
||||||
log.info(
|
log.info(
|
||||||
"{}: Rant by {} is not sus.".format(
|
"{}: Rant by {} is not sus by traditional method..".format(
|
||||||
self.name, rant["user_username"]
|
self.name, rant["user_username"]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
continue
|
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"]))
|
||||||
log.warning(
|
log.warning(
|
||||||
"{}: Rant is not {} flagged as sus yet.".format(
|
"{}: Rant by {} is not flagged as sus yet but should be.".format(
|
||||||
self.name, rant["user_username"]
|
self.name, rant["user_username"]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -202,7 +208,7 @@ class Bot:
|
|||||||
self.name, rant["user_username"]
|
self.name, rant["user_username"]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.mark_as_sus(rant)
|
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