File size: 3,670 Bytes
f90d21b f32ead8 f90d21b f32ead8 f90d21b f32ead8 f90d21b f32ead8 f90d21b f32ead8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
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() |