50 lines
1.5 KiB
Python
Executable File
50 lines
1.5 KiB
Python
Executable File
from functions.get_user_details import get_user_details
|
|
from functions.suspend_user import suspend_user_with_reason
|
|
from functions.send_message import send_message
|
|
import var
|
|
from beloved_logger import logger
|
|
import logging
|
|
|
|
|
|
forbidden_strings = [
|
|
'[mod]',
|
|
'[moderator]',
|
|
'[admin]',
|
|
'[administrator]',
|
|
'[chat mod]',
|
|
'[chat moderator]',
|
|
'yahir'
|
|
]
|
|
|
|
forbidden_strings_username = [
|
|
'ken',
|
|
'rack',
|
|
'sjb',
|
|
'yahir'
|
|
]
|
|
|
|
async def check_users():
|
|
user_details = await get_user_details(var.current_user_id+1)
|
|
|
|
if user_details is None:
|
|
return
|
|
|
|
var.current_user_id = var.current_user_id+1
|
|
|
|
if 'username' in user_details['data']:
|
|
username = user_details['data']['username'].lower()
|
|
|
|
if any(forbidden in username for forbidden in forbidden_strings_username):
|
|
await suspend_user_with_reason(var.current_user_id, "detected forbidden name text")
|
|
await send_message(f"User with forbidden username @{username} detected and banned for 24 hours. users/{var.current_user_id}")
|
|
|
|
if 'name' in user_details['data']:
|
|
if user_details['data']['name'] is None:
|
|
return
|
|
|
|
name = user_details['data']['name'].lower()
|
|
|
|
if any(forbidden in name for forbidden in forbidden_strings):
|
|
await suspend_user_with_reason(var.current_user_id, "detected forbidden name text")
|
|
await send_message(f"User with forbidden display name '{name}' detected and banned for 24 hours. users/{var.current_user_id}")
|