update
This commit is contained in:
parent
ca59f2882a
commit
fa629f27e5
|
@ -52,6 +52,10 @@ class Post:
|
||||||
async def analyse_text(self):
|
async def analyse_text(self):
|
||||||
logger.info(f"Getting text analysis of post with post ID {self.post_id}")
|
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:
|
if self.post_name:
|
||||||
for word in var.filters_list:
|
for word in var.filters_list:
|
||||||
if word.lower() in self.post_name.lower() and word not in self.infringing_words:
|
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.")
|
f"but it was not enabled. Post will not be deleted.")
|
||||||
one_rating_was_false = True
|
one_rating_was_false = True
|
||||||
|
|
||||||
if one_rating_was_false:
|
# if one_rating_was_false:
|
||||||
self.post_will_be_deleted = False
|
# self.post_will_be_deleted = False
|
||||||
self.ratings = None
|
# self.ratings = None
|
||||||
|
|
||||||
async def remove_post(self):
|
async def remove_post(self):
|
||||||
var.most_recently_deleted_post_id = self.post_id
|
var.most_recently_deleted_post_id = self.post_id
|
||||||
|
@ -134,11 +138,10 @@ class Post:
|
||||||
return ratings_string
|
return ratings_string
|
||||||
|
|
||||||
async def get_as_text_detection_text(self):
|
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'🗒️ *TITLE:* "{self.post_name}"\n' +
|
||||||
f"🔗 *URL:* https://{var.site}/admin/posts/{self.post_id}\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"👤 *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..")
|
|
||||||
return string
|
return string
|
||||||
|
|
||||||
async def get_as_image_deletion_text(self):
|
async def get_as_image_deletion_text(self):
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import var
|
import var
|
||||||
import json
|
import json
|
||||||
|
from beloved_logger import logger
|
||||||
|
|
||||||
|
|
||||||
class Rating:
|
class Rating:
|
||||||
|
@ -22,8 +23,6 @@ class Rating:
|
||||||
|
|
||||||
top_level_true = []
|
top_level_true = []
|
||||||
top_level_false = []
|
top_level_false = []
|
||||||
lower_level_true = []
|
|
||||||
lower_level_false = []
|
|
||||||
|
|
||||||
for top_level_object, top_level_data in data.items():
|
for top_level_object, top_level_data in data.items():
|
||||||
if top_level_data.get("status") is True:
|
if top_level_data.get("status") is True:
|
||||||
|
@ -31,21 +30,16 @@ class Rating:
|
||||||
elif top_level_data.get("status") is False:
|
elif top_level_data.get("status") is False:
|
||||||
top_level_false.append(top_level_object)
|
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:
|
if self.name in top_level_true:
|
||||||
self.type = "primary"
|
self.type = "primary"
|
||||||
return True
|
return True
|
||||||
|
if self.name in top_level_false:
|
||||||
|
self.type = "primary"
|
||||||
|
return False
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def create_ratings(response):
|
def create_ratings(response):
|
||||||
ratings = []
|
ratings = []
|
||||||
for label in response['ModerationLabels']:
|
for label in response['ModerationLabels']:
|
||||||
|
|
|
@ -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
|
||||||
|
|
161
data/labels.json
161
data/labels.json
|
@ -1,69 +1,94 @@
|
||||||
{
|
{
|
||||||
"Explicit Nudity": {
|
"Explicit": {
|
||||||
"status": true,
|
"status": true,
|
||||||
"Nudity": true,
|
"Explicit Nudity": {
|
||||||
"Graphic Male Nudity": true,
|
"status": true,
|
||||||
"Graphic Female Nudity": true,
|
"Exposed Male Genitalia": true,
|
||||||
"Sexual Activity": true,
|
"Exposed Female Genitalia": true,
|
||||||
"Illustrated Explicit Nudity": true,
|
"Exposed Buttocks or Anus": true,
|
||||||
"Adult Toys": true
|
"Exposed Female Nipple": true
|
||||||
},
|
},
|
||||||
"Suggestive": {
|
"Explicit Sexual Activity": true,
|
||||||
"status": true,
|
"Sex Toys": true
|
||||||
"Female Swimwear Or Underwear": false,
|
},
|
||||||
"Male Swimwear Or Underwear": false,
|
"Non-Explicit Nudity of Intimate parts and Kissing": {
|
||||||
"Partial Nudity": false,
|
"status": false,
|
||||||
"Barechested Male": false,
|
"Non-Explicit Nudity": {
|
||||||
"Revealing Clothes": false,
|
"status": true,
|
||||||
"Sexual Situations": true
|
"Bare Back": true,
|
||||||
},
|
"Exposed Male Nipple": true,
|
||||||
"Violence": {
|
"Partially Exposed Buttocks": true,
|
||||||
"status": true,
|
"Partially Exposed Female Breast": true,
|
||||||
"Graphic Violence Or Gore": true,
|
"Implied Nudity": true
|
||||||
"Physical Violence": true,
|
},
|
||||||
"Weapon Violence": true,
|
"Obstructed Intimate Parts": {
|
||||||
"Weapons": false,
|
"status": true,
|
||||||
"Self Injury": true
|
"Obstructed Female Nipple": true,
|
||||||
},
|
"Obstructed Male Genitalia": true
|
||||||
"Visually Disturbing":
|
},
|
||||||
{
|
"Kissing on the Lips": true
|
||||||
"status": true,
|
},
|
||||||
"Emaciated Bodies": true,
|
"Swimwear or Underwear": {
|
||||||
"Corpses": true,
|
"status": false,
|
||||||
"Hanging": true,
|
"Female Swimwear or Underwear": true,
|
||||||
"Air Crash": false,
|
"Male Swimwear or Underwear": true
|
||||||
"Explosions And Blasts": false
|
},
|
||||||
},
|
"Violence": {
|
||||||
"Rude Gestures":
|
"status": true,
|
||||||
{
|
"Weapons": true,
|
||||||
"status": false,
|
"Graphic Violence": {
|
||||||
"Middle Finger": false
|
"status": true,
|
||||||
},
|
"Weapon Violence": true,
|
||||||
"Drugs": {
|
"Physical Violence": true
|
||||||
"status": false,
|
},
|
||||||
"Drug Products": false,
|
"Self-Harm": true,
|
||||||
"Drug Use": false,
|
"Blood & Gore": true,
|
||||||
"Pills": false,
|
"Explosions and Blasts": true
|
||||||
"Drug Paraphernalia": false
|
},
|
||||||
},
|
"Visually Disturbing": {
|
||||||
"Tobacco": {
|
"status": false,
|
||||||
"status": false,
|
"Death and Emaciation": {
|
||||||
"Tobacco Products": false,
|
"status": true,
|
||||||
"Smoking": false
|
"Emaciated Bodies": true,
|
||||||
},
|
"Corpses": true
|
||||||
"Alcohol": {
|
},
|
||||||
"status": false,
|
"Crashes": {
|
||||||
"Drinking": false,
|
"status": true,
|
||||||
"Alcoholic Beverages": false
|
"Air Crash": true
|
||||||
},
|
}
|
||||||
"Gambling": {
|
},
|
||||||
"status": false,
|
"Drugs & Tobacco": {
|
||||||
"Gambling": false
|
"status": false,
|
||||||
},
|
"Products": {
|
||||||
"Hate Symbols": {
|
"status": true,
|
||||||
"status": true,
|
"Pills": true
|
||||||
"Nazi Party": true,
|
},
|
||||||
"White Supremacy": true,
|
"Drugs & Tobacco Paraphernalia & Use": {
|
||||||
"Extremist": true
|
"status": true,
|
||||||
}
|
"Smoking": true
|
||||||
}
|
},
|
||||||
|
"Alcohol": {
|
||||||
|
"status": true,
|
||||||
|
"Alcohol Use": {
|
||||||
|
"status": true,
|
||||||
|
"Drinking": true
|
||||||
|
},
|
||||||
|
"Alcoholic Beverages": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Rude Gestures": {
|
||||||
|
"status": false,
|
||||||
|
"Middle Finger": true
|
||||||
|
},
|
||||||
|
"Gambling": {
|
||||||
|
"status": false
|
||||||
|
},
|
||||||
|
"Hate Symbols": {
|
||||||
|
"status": true,
|
||||||
|
"Nazi Party": true,
|
||||||
|
"White Supremacy": true
|
||||||
|
},
|
||||||
|
"Extremist": {
|
||||||
|
"status": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ async def scan_posts():
|
||||||
|
|
||||||
if var.image_scanning_is_running:
|
if var.image_scanning_is_running:
|
||||||
if var.scan_new_users_only:
|
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")
|
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 "
|
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 = {}
|
old_chat = {}
|
||||||
scan_new_users_only = True
|
scan_new_users_only = True
|
||||||
image_scanning_is_running = True
|
image_scanning_is_running = True
|
||||||
text_scanning_is_running = False
|
text_scanning_is_running = True
|
||||||
most_recently_deleted_post_id = 0
|
most_recently_deleted_post_id = 0
|
||||||
current_posts_at_start_time = None
|
current_posts_at_start_time = None
|
||||||
bot_started_at = None
|
bot_started_at = None
|
||||||
|
|
Loading…
Reference in New Issue