update
This commit is contained in:
parent
ca59f2882a
commit
fa629f27e5
|
@ -52,6 +52,10 @@ class Post:
|
|||
async def analyse_text(self):
|
||||
logger.info(f"Getting text analysis of post with post ID {self.post_id}")
|
||||
|
||||
logger.info(self.post_name)
|
||||
logger.info(self.post_description)
|
||||
logger.info(var.filters_list)
|
||||
|
||||
if self.post_name:
|
||||
for word in var.filters_list:
|
||||
if word.lower() in self.post_name.lower() and word not in self.infringing_words:
|
||||
|
@ -103,9 +107,9 @@ class Post:
|
|||
f"but it was not enabled. Post will not be deleted.")
|
||||
one_rating_was_false = True
|
||||
|
||||
if one_rating_was_false:
|
||||
self.post_will_be_deleted = False
|
||||
self.ratings = None
|
||||
# if one_rating_was_false:
|
||||
# self.post_will_be_deleted = False
|
||||
# self.ratings = None
|
||||
|
||||
async def remove_post(self):
|
||||
var.most_recently_deleted_post_id = self.post_id
|
||||
|
@ -134,11 +138,10 @@ class Post:
|
|||
return ratings_string
|
||||
|
||||
async def get_as_text_detection_text(self):
|
||||
string = (f'‼️ *DETECTED:* "{await self.get_censorship_string()}"\n' +
|
||||
string = (f'‼️ *DETECTED:TEXT:* "{await self.get_censorship_string()}"\n' +
|
||||
f'🗒️ *TITLE:* "{self.post_name}"\n' +
|
||||
f"🔗 *URL:* https://{var.site}/admin/posts/{self.post_id}\n" +
|
||||
f"👤 *POSTER:* https://{var.site}/users/{self.user_id} / @{self.poster_username}\n"
|
||||
f"The user was also suspended for a day, you will have to reverse this suspension if the moderation action was not warranted..")
|
||||
f"👤 *POSTER:* https://{var.site}/users/{self.user_id} / @{self.poster_username}\n")
|
||||
return string
|
||||
|
||||
async def get_as_image_deletion_text(self):
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import var
|
||||
import json
|
||||
from beloved_logger import logger
|
||||
|
||||
|
||||
class Rating:
|
||||
|
@ -22,8 +23,6 @@ class Rating:
|
|||
|
||||
top_level_true = []
|
||||
top_level_false = []
|
||||
lower_level_true = []
|
||||
lower_level_false = []
|
||||
|
||||
for top_level_object, top_level_data in data.items():
|
||||
if top_level_data.get("status") is True:
|
||||
|
@ -31,19 +30,14 @@ class Rating:
|
|||
elif top_level_data.get("status") is False:
|
||||
top_level_false.append(top_level_object)
|
||||
|
||||
for lower_level_object, lower_level_status in top_level_data.items():
|
||||
if lower_level_status is True and lower_level_object != "status":
|
||||
lower_level_true.append(f"{lower_level_object}")
|
||||
elif lower_level_status is False and lower_level_object != "status":
|
||||
lower_level_false.append(f"{lower_level_object}")
|
||||
|
||||
if self.name in lower_level_true:
|
||||
self.type = "secondary"
|
||||
return True
|
||||
if self.name in top_level_true:
|
||||
self.type = "primary"
|
||||
return True
|
||||
if self.name in top_level_false:
|
||||
self.type = "primary"
|
||||
return False
|
||||
return False
|
||||
|
||||
|
||||
|
||||
def create_ratings(response):
|
||||
|
|
|
@ -1 +1,21 @@
|
|||
boto3~=1.28.39\nselenium~=4.12.0\npy-cord\nrequests~=2.31.0\npython-dotenv
|
||||
|
||||
brenton
|
||||
tarrant
|
||||
|
||||
breivik
|
||||
|
||||
1488
|
||||
|
||||
niggers
|
||||
nigger
|
||||
nigga
|
||||
faggot
|
||||
fag
|
||||
kike
|
||||
ngger
|
||||
niggr
|
||||
|
||||
|
||||
|
||||
yahir
|
||||
wintendo
|
||||
|
|
109
data/labels.json
109
data/labels.json
|
@ -1,69 +1,94 @@
|
|||
{
|
||||
"Explicit": {
|
||||
"status": true,
|
||||
"Explicit Nudity": {
|
||||
"status": true,
|
||||
"Nudity": true,
|
||||
"Graphic Male Nudity": true,
|
||||
"Graphic Female Nudity": true,
|
||||
"Sexual Activity": true,
|
||||
"Illustrated Explicit Nudity": true,
|
||||
"Adult Toys": true
|
||||
"Exposed Male Genitalia": true,
|
||||
"Exposed Female Genitalia": true,
|
||||
"Exposed Buttocks or Anus": true,
|
||||
"Exposed Female Nipple": true
|
||||
},
|
||||
"Suggestive": {
|
||||
"Explicit Sexual Activity": true,
|
||||
"Sex Toys": true
|
||||
},
|
||||
"Non-Explicit Nudity of Intimate parts and Kissing": {
|
||||
"status": false,
|
||||
"Non-Explicit Nudity": {
|
||||
"status": true,
|
||||
"Female Swimwear Or Underwear": false,
|
||||
"Male Swimwear Or Underwear": false,
|
||||
"Partial Nudity": false,
|
||||
"Barechested Male": false,
|
||||
"Revealing Clothes": false,
|
||||
"Sexual Situations": true
|
||||
"Bare Back": true,
|
||||
"Exposed Male Nipple": true,
|
||||
"Partially Exposed Buttocks": true,
|
||||
"Partially Exposed Female Breast": true,
|
||||
"Implied Nudity": true
|
||||
},
|
||||
"Obstructed Intimate Parts": {
|
||||
"status": true,
|
||||
"Obstructed Female Nipple": true,
|
||||
"Obstructed Male Genitalia": true
|
||||
},
|
||||
"Kissing on the Lips": true
|
||||
},
|
||||
"Swimwear or Underwear": {
|
||||
"status": false,
|
||||
"Female Swimwear or Underwear": true,
|
||||
"Male Swimwear or Underwear": true
|
||||
},
|
||||
"Violence": {
|
||||
"status": true,
|
||||
"Graphic Violence Or Gore": true,
|
||||
"Physical Violence": true,
|
||||
"Weapons": true,
|
||||
"Graphic Violence": {
|
||||
"status": true,
|
||||
"Weapon Violence": true,
|
||||
"Weapons": false,
|
||||
"Self Injury": true
|
||||
"Physical Violence": true
|
||||
},
|
||||
"Visually Disturbing":
|
||||
{
|
||||
"Self-Harm": true,
|
||||
"Blood & Gore": true,
|
||||
"Explosions and Blasts": true
|
||||
},
|
||||
"Visually Disturbing": {
|
||||
"status": false,
|
||||
"Death and Emaciation": {
|
||||
"status": true,
|
||||
"Emaciated Bodies": true,
|
||||
"Corpses": true,
|
||||
"Hanging": true,
|
||||
"Air Crash": false,
|
||||
"Explosions And Blasts": false
|
||||
"Corpses": true
|
||||
},
|
||||
"Rude Gestures":
|
||||
{
|
||||
"status": false,
|
||||
"Middle Finger": false
|
||||
"Crashes": {
|
||||
"status": true,
|
||||
"Air Crash": true
|
||||
}
|
||||
},
|
||||
"Drugs": {
|
||||
"Drugs & Tobacco": {
|
||||
"status": false,
|
||||
"Drug Products": false,
|
||||
"Drug Use": false,
|
||||
"Pills": false,
|
||||
"Drug Paraphernalia": false
|
||||
"Products": {
|
||||
"status": true,
|
||||
"Pills": true
|
||||
},
|
||||
"Tobacco": {
|
||||
"status": false,
|
||||
"Tobacco Products": false,
|
||||
"Smoking": false
|
||||
"Drugs & Tobacco Paraphernalia & Use": {
|
||||
"status": true,
|
||||
"Smoking": true
|
||||
},
|
||||
"Alcohol": {
|
||||
"status": true,
|
||||
"Alcohol Use": {
|
||||
"status": true,
|
||||
"Drinking": true
|
||||
},
|
||||
"Alcoholic Beverages": true
|
||||
}
|
||||
},
|
||||
"Rude Gestures": {
|
||||
"status": false,
|
||||
"Drinking": false,
|
||||
"Alcoholic Beverages": false
|
||||
"Middle Finger": true
|
||||
},
|
||||
"Gambling": {
|
||||
"status": false,
|
||||
"Gambling": false
|
||||
"status": false
|
||||
},
|
||||
"Hate Symbols": {
|
||||
"status": true,
|
||||
"Nazi Party": true,
|
||||
"White Supremacy": true,
|
||||
"Extremist": true
|
||||
"White Supremacy": true
|
||||
},
|
||||
"Extremist": {
|
||||
"status": true
|
||||
}
|
||||
}
|
|
@ -33,7 +33,7 @@ async def scan_posts():
|
|||
|
||||
if var.image_scanning_is_running:
|
||||
if var.scan_new_users_only:
|
||||
cut_off_date = datetime.now() - timedelta(weeks=2)
|
||||
cut_off_date = datetime.now() - timedelta(days=3)
|
||||
current_date = datetime.strptime(post_to_analyse.poster_sign_up_time, "%Y-%m-%d %H:%M:%S")
|
||||
|
||||
logger.debug(f"User signed up at {current_date}, we are checking for "
|
||||
|
|
2
var.py
2
var.py
|
@ -21,7 +21,7 @@ aws_region = os.getenv("AWS_REGION")
|
|||
old_chat = {}
|
||||
scan_new_users_only = True
|
||||
image_scanning_is_running = True
|
||||
text_scanning_is_running = False
|
||||
text_scanning_is_running = True
|
||||
most_recently_deleted_post_id = 0
|
||||
current_posts_at_start_time = None
|
||||
bot_started_at = None
|
||||
|
|
Loading…
Reference in New Issue