chore: try to block spam

This commit is contained in:
2025-12-15 17:55:48 +01:00
parent d008d19ba3
commit 8713ff3b2d

View File

@@ -1,4 +1,5 @@
import time
import re
from datetime import timedelta
import discord
@@ -463,6 +464,16 @@ async def handle_message(message, bot):
await message.delete()
return
image_pattern = r"\.(?:jpg|jpeg|png|gif|webp|bmp)\b"
raw_attachment_count = len(
re.findall(image_pattern, message.content, re.IGNORECASE)
)
if raw_attachment_count > 3:
member = message.guild.get_member(message.author.id)
await timeout_member(member, timedelta(minutes=5), "Suspicious")
await message.delete()
return
if "@everyone" in message.content or "@here" in message.content:
if not message.channel.permissions_for(message.author).mention_everyone:
spam_role = message.guild.get_role(SPAM_ROLE_ID)