Spaces:
Runtime error
Runtime error
| from pyrogram import Client, filters | |
| from pyrogram.types import Message | |
| from Devine import app | |
| 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 | |
| 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) | |