actually make the spam filter work im sozzles teddles

This commit is contained in:
TED A. ⭕ 2025-09-11 12:04:59 +00:00
parent 966d1edab4
commit 2232bc4267
3 changed files with 25 additions and 15 deletions

View File

@ -68,17 +68,26 @@ async def scan_posts():
await send_message(message_string, post_to_analyse.poster_username)
if var.spam_scanning_is_running and post_to_analyse.poster_sign_up_time:
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")
if current_date > cut_off_date:
cut_off_date = datetime.now() - timedelta(days=1)
current_date = datetime.strptime(post_to_analyse.poster_sign_up_time, "%Y-%m-%d %H:%M:%S")
if (current_date > cut_off_date):
akismet_client = await akismet.AsyncClient.validated_client()
if await akismet_client.comment_check(
comment_content=post_to_analyse.post_description,
comment_type="comment",
comment_author=post_to_analyse.poster_username,
user_ip="0.0.0.0"
):
comment_is_spam = await akismet_client.comment_check(
comment_content=str(post_to_analyse.post_name) + str(post_to_analyse.post_description),
comment_type="comment",
comment_author=post_to_analyse.poster_username,
user_ip="103.72.61.14"
)
if("https:" in post_to_analyse.post_name or "https:" in post_to_analyse.post_description):
if("sketchersunited.org" in post_to_analyse.post_name or "sketchersunited.org" in post_to_analyse.post_description):
pass
else:
# if a user posts to a link whilst being signed up only one day, always remove it as spam
comment_is_spam = True
if comment_is_spam:
message_string = f"""👋 Hello, I am an automatic moderation bot for Sketchers United.
Your most recent post titled '{post_to_analyse.post_name}' was removed automatically as it was detected to have spam content.

1
pip-selfcheck.json Normal file
View File

@ -0,0 +1 @@
{"last_check":"2025-08-20T13:41:33Z","pypi_version":"25.2"}

View File

@ -1,7 +1,7 @@
boto3~=1.28.39
boto3
requests
python-dotenv~=1.0.0
websockets~=11.0.3
beautifulsoup4~=4.12.2
python-dotenv
websockets
beautifulsoup4
aiohttp
akismet