randydev commited on
Commit
1ebfe9a
Β·
verified Β·
1 Parent(s): 076bde9
Files changed (1) hide show
  1. main.py +14 -2
main.py CHANGED
@@ -62,7 +62,7 @@ async def unwarn_button(client, callback_query):
62
  await callback_query.message.delete()
63
  return
64
  await db.warns.delete_one({"chat_id": chat_id, "user_id": user_id})
65
- await callback_query.message.edit_text(f"βœ… Peringatan untuk <code>{user_id}</code> telah dihapus.")
66
 
67
  @bot.on_callback_query(filters.regex(r"^warn_(\d+)_(-?\d+)$"))
68
  async def warn_button(client, callback_query):
@@ -154,7 +154,7 @@ async def warn(client, message):
154
  except ValueError:
155
  return await message.reply_text("GAK ADA USER ID NYA? GIMANA NARIK BOT KE GRUP LU?")
156
  else:
157
- return await message.reply_text("GAK ADA USER ID NYA? GIMANA NARIK BOT KE GRUP LU?")
158
 
159
  if user_id == client.me.id:
160
  return await message.reply_text("GAK BISA WARN BOT SENDIRI! GIMANA NARIK BOT KE GRUP LU?")
@@ -164,6 +164,12 @@ async def warn(client, message):
164
  except Exception:
165
  return await message.reply_text("❌ User tidak ditemukan.")
166
 
 
 
 
 
 
 
167
  member_admin = await client.get_chat_member(message.chat.id, get_user.id)
168
  if member_admin.status == ChatMemberStatus.BANNED:
169
  return await message.reply_text("GAK BISA WARN USER YANG SUDAH DI BANNED! GIMANA NARIK BOT KE GRUP LU?")
@@ -243,6 +249,12 @@ async def delwarn(client, message):
243
 
244
  if user_id == client.me.id:
245
  return await message.reply_text("GAK BISA HAPUS PERINGATAN BOT SENDIRI! GIMANA NARIK BOT KE GRUP LU?")
 
 
 
 
 
 
246
 
247
  try:
248
  get_user = await client.get_users(user_id)
 
62
  await callback_query.message.delete()
63
  return
64
  await db.warns.delete_one({"chat_id": chat_id, "user_id": user_id})
65
+ await callback_query.message.edit_text(f"βœ… Peringatan untuk <code>[{user_id}]</code> telah dihapus.")
66
 
67
  @bot.on_callback_query(filters.regex(r"^warn_(\d+)_(-?\d+)$"))
68
  async def warn_button(client, callback_query):
 
154
  except ValueError:
155
  return await message.reply_text("GAK ADA USER ID NYA? GIMANA NARIK BOT KE GRUP LU?")
156
  else:
157
+ return await message.reply_text("❌ Format salah. Balas pesan atau kirim /warn [user_id]")
158
 
159
  if user_id == client.me.id:
160
  return await message.reply_text("GAK BISA WARN BOT SENDIRI! GIMANA NARIK BOT KE GRUP LU?")
 
164
  except Exception:
165
  return await message.reply_text("❌ User tidak ditemukan.")
166
 
167
+ get_data = await db.antieval.find_one(
168
+ {"bot_id": client.me.id}
169
+ )
170
+ if get_data and user_id in get_data.get("whitelist_user", []):
171
+ return await message.reply_text("GAK BISA WARN USER YANG SUDAH DI WHITELIST! GIMANA NARIK BOT KE GRUP LU?")
172
+
173
  member_admin = await client.get_chat_member(message.chat.id, get_user.id)
174
  if member_admin.status == ChatMemberStatus.BANNED:
175
  return await message.reply_text("GAK BISA WARN USER YANG SUDAH DI BANNED! GIMANA NARIK BOT KE GRUP LU?")
 
249
 
250
  if user_id == client.me.id:
251
  return await message.reply_text("GAK BISA HAPUS PERINGATAN BOT SENDIRI! GIMANA NARIK BOT KE GRUP LU?")
252
+
253
+ get_data = await db.antieval.find_one(
254
+ {"bot_id": client.me.id}
255
+ )
256
+ if get_data and user_id in get_data.get("whitelist_user", []):
257
+ return await message.reply_text("GAK BISA HAPUS PERINGATAN USER YANG SUDAH DI WHITELIST! GIMANA NARIK BOT KE GRUP LU?")
258
 
259
  try:
260
  get_user = await client.get_users(user_id)