Spaces:
Running
Running
Update
Browse files
main.py
CHANGED
@@ -16,7 +16,7 @@ from pyrogram.enums import MessageEntityType
|
|
16 |
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
17 |
from config import *
|
18 |
from database import db
|
19 |
-
from helper_regex import is_blocked_markdown_code
|
20 |
|
21 |
logging.basicConfig(
|
22 |
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
@@ -82,6 +82,15 @@ async def start(client, message):
|
|
82 |
@bot.on_chat_member_updated(filters.group)
|
83 |
async def group_join(client, message):
|
84 |
if message.new_chat_member.user.id == client.me.id:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
privileges = message.new_chat_member.privileges
|
86 |
|
87 |
if not privileges or not privileges.can_restrict_members or not privileges.can_delete_messages:
|
@@ -93,15 +102,7 @@ async def group_join(client, message):
|
|
93 |
await client.leave_chat(message.chat.id)
|
94 |
logging.info(f"Left group: {message.chat.title} ({message.chat.id})")
|
95 |
return
|
96 |
-
|
97 |
-
if message.chat.id in LEAVE_GROUP_LIST:
|
98 |
-
await client.leave_chat(message.chat.id)
|
99 |
-
await message.reply_text(
|
100 |
-
"GUA KELUAR DULU YA! LU TARIK BOT KE GRUP DEVELOPER YANG SUDAH DIBLACKLIST! π₯\n"
|
101 |
-
"GAK MALU APA TARIK BOT TAPI GAK TAU ATURAN?\n"
|
102 |
-
"INI BUKAN BOT PAJANGAN, INI BOT ANTI EVAL! π«π§ "
|
103 |
-
)
|
104 |
-
return
|
105 |
await db.antieval.update_one(
|
106 |
{"bot_id": client.me.id},
|
107 |
{"$addToSet": {"chat_id": message.chat.id}},
|
@@ -123,21 +124,31 @@ async def block_inline_via_bot(client, message):
|
|
123 |
await client.leave_chat(message.chat.id)
|
124 |
logging.info(f"Left group: {message.chat.title} ({message.chat.id})")
|
125 |
return
|
126 |
-
|
127 |
username = message.via_bot.username.lower()
|
128 |
if any(ok in username for ok in BLOCKED_INLINE_BOTS):
|
129 |
-
logging.info(f"Blocked message from {message.from_user.first_name} in {message.chat.title}")
|
130 |
return await message.delete()
|
|
|
131 |
if message.via_bot and "eval" in message.via_bot.username.lower():
|
132 |
-
logging.info(f"Blocked message from {message.from_user.first_name} in {message.chat.title}")
|
133 |
return await message.delete()
|
|
|
|
|
|
|
|
|
|
|
134 |
if has_code_entity(message):
|
135 |
-
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
@bot.on_message(filters.group, group=-1)
|
138 |
async def markdown_code(client, message):
|
139 |
if message.chat.id in [-1002407639480]:
|
140 |
-
|
141 |
check = (await client.get_chat_member(message.chat.id, client.me.id)).privileges
|
142 |
if not check or not check.can_restrict_members or not check.can_delete_messages:
|
143 |
await message.reply_text(
|
@@ -149,14 +160,18 @@ async def markdown_code(client, message):
|
|
149 |
return
|
150 |
if message.text.markdown is None:
|
151 |
return
|
|
|
|
|
|
|
|
|
|
|
152 |
if has_code_entity(message):
|
153 |
-
logging.info(f"Blocked message from {message.from_user.first_name} in {message.chat.title}")
|
154 |
-
await message.delete()
|
155 |
-
|
156 |
if is_blocked_markdown_code(message.text.markdown or ""):
|
157 |
-
logging.info(f"Blocked message from {message.from_user.first_name} in {message.chat.title}")
|
158 |
-
await message.delete()
|
159 |
-
return
|
160 |
|
161 |
@bot.on_message(filters.regex(eval_regex) & filters.group)
|
162 |
async def block_userbot_eval(client, message):
|
@@ -171,7 +186,7 @@ async def block_userbot_eval(client, message):
|
|
171 |
await client.leave_chat(message.chat.id)
|
172 |
logging.info(f"Left group: {message.chat.title} ({message.chat.id})")
|
173 |
return
|
174 |
-
logging.info(f"Blocked message from {message.from_user.first_name} in {message.chat.title}")
|
175 |
await message.delete()
|
176 |
|
177 |
async def main():
|
|
|
16 |
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
17 |
from config import *
|
18 |
from database import db
|
19 |
+
from helper_regex import is_blocked_markdown_code, is_blocked_font_stylish
|
20 |
|
21 |
logging.basicConfig(
|
22 |
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
|
|
82 |
@bot.on_chat_member_updated(filters.group)
|
83 |
async def group_join(client, message):
|
84 |
if message.new_chat_member.user.id == client.me.id:
|
85 |
+
if message.chat.id in LEAVE_GROUP_LIST:
|
86 |
+
await client.leave_chat(message.chat.id)
|
87 |
+
await message.reply_text(
|
88 |
+
"GUA KELUAR DULU YA! LU TARIK BOT KE GRUP DEVELOPER YANG SUDAH DIBLACKLIST! π₯\n"
|
89 |
+
"GAK MALU APA TARIK BOT TAPI GAK TAU ATURAN?\n"
|
90 |
+
"INI BUKAN BOT PAJANGAN, INI BOT ANTI EVAL! π«π§ "
|
91 |
+
)
|
92 |
+
return
|
93 |
+
|
94 |
privileges = message.new_chat_member.privileges
|
95 |
|
96 |
if not privileges or not privileges.can_restrict_members or not privileges.can_delete_messages:
|
|
|
102 |
await client.leave_chat(message.chat.id)
|
103 |
logging.info(f"Left group: {message.chat.title} ({message.chat.id})")
|
104 |
return
|
105 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
await db.antieval.update_one(
|
107 |
{"bot_id": client.me.id},
|
108 |
{"$addToSet": {"chat_id": message.chat.id}},
|
|
|
124 |
await client.leave_chat(message.chat.id)
|
125 |
logging.info(f"Left group: {message.chat.title} ({message.chat.id})")
|
126 |
return
|
|
|
127 |
username = message.via_bot.username.lower()
|
128 |
if any(ok in username for ok in BLOCKED_INLINE_BOTS):
|
129 |
+
logging.info(f"Blocked inline via bot message from {message.from_user.first_name} in {message.chat.title}")
|
130 |
return await message.delete()
|
131 |
+
|
132 |
if message.via_bot and "eval" in message.via_bot.username.lower():
|
133 |
+
logging.info(f"Blocked inline via bot message from {message.from_user.first_name} in {message.chat.title}")
|
134 |
return await message.delete()
|
135 |
+
|
136 |
+
if is_blocked_font_stylish(message.text):
|
137 |
+
logging.info(f"is_blocked_font_stylish: Blocked inline message from {message.from_user.first_name} in {message.chat.title}")
|
138 |
+
return await message.delete()
|
139 |
+
|
140 |
if has_code_entity(message):
|
141 |
+
logging.info(f"has_code_entity: Blocked inline message from {message.from_user.first_name} in {message.chat.title}")
|
142 |
+
return await message.delete()
|
143 |
+
|
144 |
+
if is_blocked_markdown_code(message.text.markdown or ""):
|
145 |
+
logging.info(f"is_blocked_markdown_code: Blocked message from {message.from_user.first_name} in {message.chat.title}")
|
146 |
+
return await message.delete()
|
147 |
|
148 |
@bot.on_message(filters.group, group=-1)
|
149 |
async def markdown_code(client, message):
|
150 |
if message.chat.id in [-1002407639480]:
|
151 |
+
return
|
152 |
check = (await client.get_chat_member(message.chat.id, client.me.id)).privileges
|
153 |
if not check or not check.can_restrict_members or not check.can_delete_messages:
|
154 |
await message.reply_text(
|
|
|
160 |
return
|
161 |
if message.text.markdown is None:
|
162 |
return
|
163 |
+
|
164 |
+
if is_blocked_font_stylish(message.text):
|
165 |
+
logging.info(f"is_blocked_font_stylish: Blocked message from {message.from_user.first_name} in {message.chat.title}")
|
166 |
+
return await message.delete()
|
167 |
+
|
168 |
if has_code_entity(message):
|
169 |
+
logging.info(f"has_code_entity: Blocked message from {message.from_user.first_name} in {message.chat.title}")
|
170 |
+
return await message.delete()
|
171 |
+
|
172 |
if is_blocked_markdown_code(message.text.markdown or ""):
|
173 |
+
logging.info(f"is_blocked_markdown_code: Blocked message from {message.from_user.first_name} in {message.chat.title}")
|
174 |
+
return await message.delete()
|
|
|
175 |
|
176 |
@bot.on_message(filters.regex(eval_regex) & filters.group)
|
177 |
async def block_userbot_eval(client, message):
|
|
|
186 |
await client.leave_chat(message.chat.id)
|
187 |
logging.info(f"Left group: {message.chat.title} ({message.chat.id})")
|
188 |
return
|
189 |
+
logging.info(f"Blocked userbot message from {message.from_user.first_name} in {message.chat.title}")
|
190 |
await message.delete()
|
191 |
|
192 |
async def main():
|