from pyrogram import * from pyrogram.types import * from akn.utils.database import db from akn.langs import transdev @Client.on_message(filters.command("setgpic")) async def arzsetgpic_command(client, message): bot = (await client.get_chat_member(message.chat.id, client.me.id)).privileges if not bot.can_change_info: return await message.reply_text("I don't have enough permissions") if not message.reply_to_message: return await message.reply_text("Reply to a photo to set it as group picture.") if not message.reply_to_message.photo: return await message.reply_text("Please reply to a valid photo.") try: await client.set_chat_photo( chat_id=message.chat.id, photo=message.reply_to_message.photo.file_id, ) await message.delete() await message.reply_text("Group picture updated successfully.") except Exception as e: await message.reply(f"Failed to set group picture: {e}") @Client.on_message(filters.command("setgname")) async def arzsetgname_command(client, message): bot = (await client.get_chat_member(message.chat.id, client.me.id)).privileges if not bot.can_change_info: return await message.reply_text("I don't have enough permissions") if len(message.command) < 2: return await message.reply_text("Please provide a new group name.") new_name = " ".join(message.command[1:]) try: await client.set_chat_title( chat_id=message.chat.id, title=new_name, ) await message.delete() await message.reply_text("Group name updated successfully.") except Exception as e: await message.reply(f"Failed to set group name: {e}") @Client.on_message(filters.command("setgdesc")) async def arzsetgdesc_command(client, message): bot = (await client.get_chat_member(message.chat.id, client.me.id)).privileges if not bot.can_change_info: return await message.reply_text("I don't have enough permissions") if len(message.command) < 2: return await message.reply_text("Please provide a new group description.") new_desc = " ".join(message.command[1:]) try: await client.set_chat_description( chat_id=message.chat.id, description=new_desc, ) await message.delete() await message.reply_text("Group description updated successfully.") except Exception as e: await message.reply(f"Failed to set group description: {e}") @Client.on_message(filters.command("purge")) async def arzpurge_command(client, message): bot = (await client.get_chat_member(message.chat.id, client.me.id)).privileges if not bot.can_delete_messages: return await message.reply_text("I don't have enough permissions") if not message.reply_to_message: return await message.reply_text("Reply to message purge.") chat_id = message.chat.id message_ids = [] for message_id in range( message.reply_to_message.id, message.id, ): message_ids.append(message_id) if len(message_ids) == 100: await client.delete_messages( chat_id=chat_id, message_ids=message_ids, revoke=True, ) message_ids = [] if len(message_ids) > 0: await client.delete_messages( chat_id=chat_id, message_ids=message_ids, revoke=True, ) @Client.on_message(filters.command("del")) async def arzdel_user(_, message: Message): rep = message.reply_to_message await message.delete() await rep.delete()