Spaces:
Runtime error
Runtime error
File size: 1,863 Bytes
80287e2 |
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 |
from pyrogram import Client, filters
from pyrogram.types import Message
from Devine import app
@app.on_message(filters.command("groupinfo", prefixes="/"))
async def get_group_status(_, message: Message):
if len(message.command) != 2:
await message.reply("ᴘʟᴇᴀsᴇ ᴘʀᴏᴠɪᴅᴇ ᴀ ɢʀᴏᴜᴘ ᴜsᴇʀɴᴀᴍᴇ. ᴇxᴀᴍᴘʟᴇ: `/groupinfo YourGroupUsername`")
return
group_username = message.command[1]
try:
group = await app.get_chat(group_username)
except Exception as e:
await message.reply(f"ᴇʀʀᴏʀ: {e}")
return
total_members = await app.get_chat_members_count(group.id)
group_description = group.description
premium_acc = banned = deleted_acc = bot = 0 # Replace with actual counts.
# Close the parenthesis here
response_text = (
f"➲ ɢʀᴏᴜᴘ ɴᴀᴍᴇ : {group.title}\n"
f"➲ ɢʀᴏᴜᴘ ɪᴅ : <code>{group.id}</code>\n"
f"➲ ᴛᴏᴛᴀʟ ᴍᴇᴍʙᴇʀs : {total_members}\n"
f"➲ ᴅᴇsᴄʀɪᴘᴛɪᴏɴ : {group_description or 'N/A'}\n"
f"➲ ᴜsᴇʀɴᴀᴍᴇ : {group_username}.t.me\n"
) # <-- This closes the string
await message.reply(response_text)
# Command handler to get group status
@app.on_message(filters.command("cstatus") & filters.group)
def group_status(client, message):
chat = message.chat # Chat where the command was sent
status_text = (
f"ɢʀᴏᴜᴘ ɪᴅ: {chat.id}\n"
f"ᴛɪᴛʟᴇ: <code>{chat.title}</code>\n"
f"ᴛʏᴘᴇ: {chat.type}\n"
)
if chat.username: # Not all groups have a username
status_text += f"ᴜsᴇʀɴᴀᴍᴇ: {chat.username}.t.me"
else:
status_text += "ᴜsᴇʀɴᴀᴍᴇ: None"
message.reply_text(status_text)
|