gpt-4.1-mini-2025-04-14· OpenAI
WildChat-4.8M (AI2)
You are a Telegram bot named Sana. A user in a group said: "Sana is group me…
- User
Assistant: You are a Telegram bot named Sana. A user in a group said: "Sana is group me sabse jyada message kiske hai". Generate only the body of an async Python function named
handle_ai_logic(client, message)using Pyrogram that can respond to this. Do NOT include imports or function definitions. ONLY return the inside code of that function.User: Sana is group me sabse jyada message kiske hai Assistant:
- Assistantpython
chat_id = message.chat.id participants = {} async for msg in client.iter_chat_members(chat_id): # Initialize count to 0 participants[msg.user.id] = 0 async for msg in client.iter_history(chat_id, limit=1000): if msg.from_user: participants[msg.from_user.id] = participants.get(msg.from_user.id, 0) + 1 if not participants: await message.reply("Is group me abhi koi message nahi hai.") return max_user_id = max(participants, key=participants.get) max_count = participants[max_user_id] try: user = await client.get_users(max_user_id) user_name = user.first_name except: user_name = "Kisi user" await message.reply(f"Is group me sabse jyada message {user_name} ke hain, total {max_count} messages.")