actually make the spam filter work im sozzles teddles
This commit is contained in:
parent
966d1edab4
commit
2232bc4267
|
|
@ -68,17 +68,26 @@ async def scan_posts():
|
||||||
await send_message(message_string, post_to_analyse.poster_username)
|
await send_message(message_string, post_to_analyse.poster_username)
|
||||||
|
|
||||||
if var.spam_scanning_is_running and post_to_analyse.poster_sign_up_time:
|
if var.spam_scanning_is_running and post_to_analyse.poster_sign_up_time:
|
||||||
cut_off_date = datetime.now() - timedelta(days=3)
|
cut_off_date = datetime.now() - timedelta(days=1)
|
||||||
current_date = datetime.strptime(post_to_analyse.poster_sign_up_time,
|
current_date = datetime.strptime(post_to_analyse.poster_sign_up_time, "%Y-%m-%d %H:%M:%S")
|
||||||
"%Y-%m-%d %H:%M:%S")
|
|
||||||
if current_date > cut_off_date:
|
if (current_date > cut_off_date):
|
||||||
akismet_client = await akismet.AsyncClient.validated_client()
|
akismet_client = await akismet.AsyncClient.validated_client()
|
||||||
if await akismet_client.comment_check(
|
comment_is_spam = await akismet_client.comment_check(
|
||||||
comment_content=post_to_analyse.post_description,
|
comment_content=str(post_to_analyse.post_name) + str(post_to_analyse.post_description),
|
||||||
comment_type="comment",
|
comment_type="comment",
|
||||||
comment_author=post_to_analyse.poster_username,
|
comment_author=post_to_analyse.poster_username,
|
||||||
user_ip="0.0.0.0"
|
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.
|
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.
|
Your most recent post titled '{post_to_analyse.post_name}' was removed automatically as it was detected to have spam content.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"last_check":"2025-08-20T13:41:33Z","pypi_version":"25.2"}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
boto3~=1.28.39
|
boto3
|
||||||
requests
|
requests
|
||||||
python-dotenv~=1.0.0
|
python-dotenv
|
||||||
websockets~=11.0.3
|
websockets
|
||||||
beautifulsoup4~=4.12.2
|
beautifulsoup4
|
||||||
aiohttp
|
aiohttp
|
||||||
akismet
|
akismet
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue