File size: 1,215 Bytes
041529f
 
 
 
 
 
 
 
 
155c78b
 
3d2533e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8772d56
155c78b
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Copyright (C) 2019-2025 TeamKillerX <https://github.com/TeamKillerX>
#
# This file is part of TeamKillerX project,
# and licensed under GNU Affero General Public License v3.
# See the GNU Affero General Public License for more details.
#
# All rights reserved. See COPYING, AUTHORS.
# credits xtdevs

import re

WHITELIST_WORDS = {"eval", "admin", "bot", "python", "ok", "done", "anti"}

def contains_stylish_with_whitelist(text: str) -> bool:
    emoji_pattern = re.compile(
        "[\U0001F600-\U0001F64F"
        "\U0001F300-\U0001F5FF"
        "\U0001F680-\U0001F6FF"
        "\U0001F1E6-\U0001F1FF"
        "\u2600-\u26FF\u2700-\u27BF]+", flags=re.UNICODE
    )
    text_wo_emoji = emoji_pattern.sub('', text)

    words = text_wo_emoji.split()
    for word in words:
        if word.lower() in WHITELIST_WORDS:
            continue
        for char in word:
            if ord(char) > 127 and not char.isascii():
                return True
    return False

def is_blocked_markdown_code(message):
    pattern = r"(?:python|py|javascript|js|bash|sh|html|go|cpp|c|json)\n.*?"
    match = re.search(pattern, message, re.DOTALL | re.IGNORECASE)
    if match:
        return True
    else:
        return False