randydev commited on
Commit
38e11f3
Β·
verified Β·
1 Parent(s): f74a9e2
Files changed (1) hide show
  1. main.py +31 -28
main.py CHANGED
@@ -13,6 +13,7 @@ import asyncio
13
  import logging
14
  from pyrogram import *
15
  from pyrogram.enums import MessageEntityType
 
16
  from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
17
  from config import *
18
  from database import db
@@ -91,7 +92,6 @@ async def start_command(client, message):
91
  reply_markup=reply_markup
92
  )
93
 
94
-
95
  @bot.on_message(filters.command("addmoduser") & filters.group)
96
  async def addwhitelist(client, message):
97
  if message.from_user.id not in [6477856957]:
@@ -210,34 +210,37 @@ async def delwhitelistbot(client, message):
210
 
211
  @bot.on_chat_member_updated(filters.group)
212
  async def group_join(client, message):
213
- if message.new_chat_member.user.id == client.me.id:
214
- if message.chat.id in LEAVE_GROUP_LIST:
215
- await client.leave_chat(message.chat.id)
216
- await message.reply_text(
217
- "GUA KELUAR DULU YA! LU TARIK BOT KE GRUP DEVELOPER YANG SUDAH DIBLACKLIST! πŸ’₯\n"
218
- "GAK MALU APA TARIK BOT TAPI GAK TAU ATURAN?\n"
219
- "INI BUKAN BOT PAJANGAN, INI BOT ANTI EVAL! 🚫🧠"
220
- )
221
- return
222
-
223
- privileges = message.new_chat_member.privileges
224
-
225
- if not privileges or not privileges.can_restrict_members or not privileges.can_delete_messages:
226
- await client.send_message(
227
- message.chat.id,
228
- "GUA KELUAR DULU YA! LU NARIK BOT TAPI GAK KASIH IZIN BANNED! πŸ’₯\n"
229
- "BIKIN BOT BUAT APA KALO CUMA JADI PAJANGAN?"
 
 
 
 
 
 
 
 
 
 
230
  )
231
- await client.leave_chat(message.chat.id)
232
- logging.info(f"Left group: {message.chat.title} ({message.chat.id})")
233
- return
234
-
235
- await db.antieval.update_one(
236
- {"bot_id": client.me.id},
237
- {"$addToSet": {"chat_id": message.chat.id}},
238
- upsert=True,
239
- )
240
- logging.info(f"Added to group: {message.chat.title} ({message.chat.id})")
241
 
242
  @bot.on_message(filters.via_bot)
243
  async def block_inline_via_bot(client, message):
 
13
  import logging
14
  from pyrogram import *
15
  from pyrogram.enums import MessageEntityType
16
+ from pyrogram.errors import ChannelPrivate
17
  from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
18
  from config import *
19
  from database import db
 
92
  reply_markup=reply_markup
93
  )
94
 
 
95
  @bot.on_message(filters.command("addmoduser") & filters.group)
96
  async def addwhitelist(client, message):
97
  if message.from_user.id not in [6477856957]:
 
210
 
211
  @bot.on_chat_member_updated(filters.group)
212
  async def group_join(client, message):
213
+ try:
214
+ if message.new_chat_member and message.new_chat_member.user.id == client.me.id:
215
+ if message.chat.id in LEAVE_GROUP_LIST:
216
+ await client.leave_chat(message.chat.id)
217
+ await message.reply_text(
218
+ "GUA KELUAR DULU YA! LU TARIK BOT KE GRUP DEVELOPER YANG SUDAH DIBLACKLIST! πŸ’₯\n"
219
+ "GAK MALU APA TARIK BOT TAPI GAK TAU ATURAN?\n"
220
+ "INI BUKAN BOT PAJANGAN, INI BOT ANTI EVAL! 🚫🧠"
221
+ )
222
+ return
223
+
224
+ privileges = message.new_chat_member.privileges
225
+
226
+ if not privileges or not privileges.can_restrict_members or not privileges.can_delete_messages:
227
+ await client.send_message(
228
+ message.chat.id,
229
+ "GUA KELUAR DULU YA! LU NARIK BOT TAPI GAK KASIH IZIN BANNED! πŸ’₯\n"
230
+ "BIKIN BOT BUAT APA KALO CUMA JADI PAJANGAN?"
231
+ )
232
+ await client.leave_chat(message.chat.id)
233
+ logging.info(f"Left group: {message.chat.title} ({message.chat.id})")
234
+ return
235
+
236
+ await db.antieval.update_one(
237
+ {"bot_id": client.me.id},
238
+ {"$addToSet": {"chat_id": message.chat.id}},
239
+ upsert=True,
240
  )
241
+ logging.info(f"Added to group: {message.chat.title} ({message.chat.id})")
242
+ except ChannelPrivate:
243
+ pass
 
 
 
 
 
 
 
244
 
245
  @bot.on_message(filters.via_bot)
246
  async def block_inline_via_bot(client, message):