randydev commited on
Commit
399ef44
·
verified ·
1 Parent(s): a748a75
Files changed (1) hide show
  1. main.py +16 -0
main.py CHANGED
@@ -146,7 +146,15 @@ async def warn(client, message):
146
 
147
  if len(message.command) != 2:
148
  return await message.reply_text("GAK ADA USER ID NYA? GIMANA NARIK BOT KE GRUP LU?")
 
149
  user_id = int(message.command[1])
 
 
 
 
 
 
 
150
  try:
151
  warn_data = await db.warns.find_one({"chat_id": message.chat.id, "user_id": user_id})
152
  warn_count = 1
@@ -208,7 +216,15 @@ async def delwarn(client, message):
208
 
209
  if len(message.command) != 2:
210
  return await message.reply_text("GAK ADA USER ID NYA? GIMANA NARIK BOT KE GRUP LU?")
 
211
  user_id = int(message.command[1])
 
 
 
 
 
 
 
212
  try:
213
  warn_data = await db.warns.find_one({"chat_id": message.chat.id, "user_id": user_id})
214
  if not warn_data:
 
146
 
147
  if len(message.command) != 2:
148
  return await message.reply_text("GAK ADA USER ID NYA? GIMANA NARIK BOT KE GRUP LU?")
149
+
150
  user_id = int(message.command[1])
151
+ if user_id == client.me.id:
152
+ return await message.reply_text("GAK BISA WARN BOT SENDIRI! GIMANA NARIK BOT KE GRUP LU?")
153
+
154
+ member_admin = await client.get_chat_member(message.chat.id, user_id)
155
+ if member_admin.status in {ChatMemberStatus.ADMINISTRATOR, ChatMemberStatus.OWNER}:
156
+ return await message.reply_text("GAK BISA WARN ADMIN! GIMANA NARIK BOT KE GRUP LU?")
157
+
158
  try:
159
  warn_data = await db.warns.find_one({"chat_id": message.chat.id, "user_id": user_id})
160
  warn_count = 1
 
216
 
217
  if len(message.command) != 2:
218
  return await message.reply_text("GAK ADA USER ID NYA? GIMANA NARIK BOT KE GRUP LU?")
219
+
220
  user_id = int(message.command[1])
221
+ if user_id == client.me.id:
222
+ return await message.reply_text("GAK BISA HAPUS PERINGATAN BOT SENDIRI! GIMANA NARIK BOT KE GRUP LU?")
223
+
224
+ member_admin = await client.get_chat_member(message.chat.id, user_id)
225
+ if member_admin.status in {ChatMemberStatus.ADMINISTRATOR, ChatMemberStatus.OWNER}:
226
+ return await message.reply_text("GAK BISA HAPUS PERINGATAN ADMIN! GIMANA NARIK BOT KE GRUP LU?")
227
+
228
  try:
229
  warn_data = await db.warns.find_one({"chat_id": message.chat.id, "user_id": user_id})
230
  if not warn_data: