randydev commited on
Commit
2b7f4fa
Β·
1 Parent(s): 8a69589

fix update

Browse files
akn/AllDownloaderBot/admins.py CHANGED
@@ -1,5 +1,6 @@
1
  from pyrogram import *
2
  from pyrogram.types import *
 
3
  from akn.utils.database import db
4
 
5
  unmute_permissions = ChatPermissions(
@@ -181,6 +182,11 @@ async def arz_ban_me(client: Client, message: Message):
181
  if reason:
182
  msg += f"**Reason:** {reason}"
183
  await message.chat.ban_member(user_id)
 
 
 
 
 
184
  await message.reply_text(
185
  msg,
186
  reply_markup=InlineKeyboardMarkup(
@@ -227,6 +233,11 @@ async def arz_mute(client: Client, message: Message):
227
  if reason:
228
  msg += f"**Reason:** {reason}"
229
  await message.chat.restrict_member(user_id, ChatPermissions())
 
 
 
 
 
230
  await message.reply_text(
231
  msg,
232
  reply_markup=InlineKeyboardMarkup(
@@ -238,4 +249,64 @@ async def arz_mute(client: Client, message: Message):
238
  ]
239
  ]
240
  )
241
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  from pyrogram import *
2
  from pyrogram.types import *
3
+ from pyrogram.enums import *
4
  from akn.utils.database import db
5
 
6
  unmute_permissions = ChatPermissions(
 
182
  if reason:
183
  msg += f"**Reason:** {reason}"
184
  await message.chat.ban_member(user_id)
185
+ await db.alldl_bot.update_one(
186
+ {"bot_id": client.me.id},
187
+ {"$set": {"ban_user": user_id}},
188
+ upsert=True,
189
+ )
190
  await message.reply_text(
191
  msg,
192
  reply_markup=InlineKeyboardMarkup(
 
233
  if reason:
234
  msg += f"**Reason:** {reason}"
235
  await message.chat.restrict_member(user_id, ChatPermissions())
236
+ await db.alldl_bot.update_one(
237
+ {"bot_id": client.me.id},
238
+ {"$addToSet": {"mute_user": user_id}},
239
+ upsert=True,
240
+ )
241
  await message.reply_text(
242
  msg,
243
  reply_markup=InlineKeyboardMarkup(
 
249
  ]
250
  ]
251
  )
252
+ )
253
+
254
+ @Client.on_message(
255
+ ~filters.scheduled
256
+ & filters.command(["unmute"])
257
+ & ~filters.forwarded
258
+ )
259
+ async def arz_unmute(client: Client, message: Message):
260
+ user_id, reason = await extract_user_and_reason(message, sender_chat=True)
261
+ if not user_id:
262
+ return await message.edit_text("I can't find that user.")
263
+ if user_id == client.me.id:
264
+ return await message.edit_text("I can't unmute myself.")
265
+ if user_id == 1191668125:
266
+ return await message.edit_text("I can't unmute my developer!")
267
+ try:
268
+ mention = (await client.get_users(user_id)).mention
269
+ except IndexError:
270
+ mention = (
271
+ message.reply_to_message.sender_chat.title
272
+ if message.reply_to_message
273
+ else "Anon"
274
+ )
275
+ msg = (
276
+ f"**Unmuted User:** <a href='tg://user?id={user_id}'>{mention}</a>\n"
277
+ f"**Unmuted By:** [{message.from_user.mention}](tg://user?id={message.from_user.id if message.from_user else 0})\n"
278
+ )
279
+ if reason:
280
+ msg += f"**Reason:** {reason}"
281
+ await message.chat.unban_member(user_id)
282
+ await db.alldl_bot.update_one(
283
+ {"bot_id": client.me.id},
284
+ {"$pull": {"mute_user": user_id}},
285
+ upsert=True,
286
+ )
287
+ await message.reply_text(msg)
288
+
289
+ @Client.on_message(filters.incoming & filters.group, group=-1)
290
+ async def check_user_mute(client: Client, message: Message):
291
+ if message.from_user and message.from_user.is_bot:
292
+ return
293
+ if message.chat.type == ChatType.PRIVATE:
294
+ return
295
+ user = message.from_user.id
296
+ bot = (await client.get_chat_member(message.chat.id, client.me.id)).privileges
297
+ if not bot.can_restrict_members:
298
+ return
299
+ muted_users = await db.alldl_bot.find_one({"bot_id": client.me.id})
300
+ if muted_users and user in muted_users["mute_user"]:
301
+ await client.restrict_chat_member(
302
+ message.chat.id,
303
+ user,
304
+ permissions=ChatPermissions(
305
+ can_send_messages=False,
306
+ can_send_media_messages=False,
307
+ can_send_polls=False,
308
+ can_change_info=False,
309
+ can_invite_users=False,
310
+ can_pin_messages=False,
311
+ ),
312
+ )
akn/AllDownloaderBot/azhelp.py CHANGED
@@ -15,6 +15,22 @@ async def arzhelp_command(_, message):
15
  [
16
  InlineKeyboardButton("🧹 Clean", callback_data="rhelp_clean"),
17
  InlineKeyboardButton("πŸ”’ Lock", callback_data="rhelp_lock")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  ]
19
  ])
20
 
 
15
  [
16
  InlineKeyboardButton("🧹 Clean", callback_data="rhelp_clean"),
17
  InlineKeyboardButton("πŸ”’ Lock", callback_data="rhelp_lock")
18
+ ],
19
+ [
20
+ InlineKeyboardButton("πŸ“₯ Downloader", callback_data="rhelp_downloader"),
21
+ ],
22
+ [
23
+ InlineKeyboardButton("πŸ“Š Stats", callback_data="rhelp_stats")
24
+ ],
25
+ [
26
+ InlineKeyboardButton("πŸ”’ Force Subscribe", callback_data="rhelp_forcesub"),
27
+ InlineKeyboardButton("πŸ›‘οΈ Blacklist", callback_data="rhelp_blacklist")
28
+ ],
29
+ [
30
+ InlineKeyboardButton("βš™οΈ Bot Settings", callback_data="rhelp_botsettings"),
31
+ ],
32
+ [
33
+ InlineKeyboardButton("❌ Close", callback_data="cclose"),
34
  ]
35
  ])
36