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 latest Pyrogram version 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:
- Assistant
chat_id = message.chat.id # Fetch chat members who have sent messages (Pyrogram does not provide direct message counts, so simulate or fetch statistics if possible) # Since Pyrogram doesn't provide message count per user in group, we have to rely on chat history to calculate. # We'll iterate over recent messages in the group to count messages per user limit = 1000 # Adjust limit based on performance message_counts = {} async for msg in client.iter_history(chat_id, limit=limit): if msg.from_user: uid = msg.from_user.id message_counts[uid] = message_counts.get(uid, 0) + 1 if not message_counts: await message.reply_text("Is group mein abhi tak koi message nahi hai.") return # Find user with max messages max_uid = max(message_counts, key=message_counts.get) max_count = message_counts[max_uid] try: user = await client.get_users(max_uid) username = user.first_name if user.username: user_mention = f"[@{user.username}](tg://user?id={max_uid})" else: user_mention = f"[{username}](tg://user?id={max_uid})" except Exception: user_mention = f"user with ID {max_uid}" await message.reply_text(f"Sana ke group me sabse zyada messages bhejne wale: {user_mention} ({max_count} messages).", parse_mode="markdown")
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.