# meta developer: @origsama from .. import loader, utils from datetime import datetime @loader.tds class UserInfoMod(loader.Module): """Информация о пользователе""" strings = {"name": "UserInfo"} async def uicmd(self, message): """[reply] - Информация о пользователе""" # Получаем целевого пользователя reply = await message.get_reply_message() if reply: user = await reply.get_sender() else: user = await message.get_sender() if not user: await utils.answer(message, "❌ Не удалось получить информацию") return # Получаем полную информацию full_user = await message.client.get_entity(user.id) # Получаем общие чаты common_chats = await self.get_common_chats(message, user.id) # Формируем информацию text = f"📋 Информация о пользователе\n\n" # Основная информация text += f"👤 Основное:\n" text += f"├ ID: {user.id}\n" text += f"├ Имя: {user.first_name or ''}" if user.last_name: text += f" {user.last_name}" text += "\n" if user.username: text += f"├ Юзернейм: @{user.username}\n" # Статусы text += f"├ Бот: {'✅' if user.bot else '❌'}\n" text += f"├ Прем: {'✅' if user.premium else '❌'}\n" if hasattr(user, 'verified') and user.verified: text += f"├ Верифицирован: ✅\n" if hasattr(user, 'scam') and user.scam: text += f"├ Скам: ⚠️\n" if hasattr(user, 'fake') and user.fake: text += f"├ Фейк: ⚠️\n" # Контактная информация text += f"\n📞 Контакты:\n" if hasattr(user, 'phone') and user.phone: text += f"├ Телефон: {user.phone}\n" else: text += f"├ Телефон: скрыт\n" # Язык if hasattr(user, 'lang_code') and user.lang_code: lang_flags = { 'ru': '🇷🇺', 'en': '🇬🇧', 'uk': '🇺🇦', 'es': '🇪🇸', 'fr': '🇫🇷', 'de': '🇩🇪', 'it': '🇮🇹', 'ja': '🇯🇵', 'zh': '🇨🇳' } flag = lang_flags.get(user.lang_code, '🌐') text += f"├ Язык: {flag} {user.lang_code.upper()}\n" # Био if hasattr(full_user, 'bio') and full_user.bio: bio = full_user.bio.replace('\n', ' ').strip() if len(bio) > 100: bio = bio[:97] + "..." text += f"\n📝 О себе:\n" text += f"├ {bio}\n" # Фото if hasattr(full_user, 'photo') and full_user.photo: text += f"\n🖼 Фото: есть\n" else: text += f"\n🖼 Фото: нет\n" # Общие чаты text += f"\n💬 Общие чаты:\n" if common_chats: for i, chat in enumerate(common_chats[:5], 1): chat_name = chat.title or chat.first_name or "Без названия" if len(chat_name) > 30: chat_name = chat_name[:27] + "..." text += f"├ {i}. {chat_name}\n" if len(common_chats) > 5: text += f"└ и ещё {len(common_chats) - 5} чатов\n" else: text += f"├ Нет общих чатов\n" # Дата регистрации (примерная) if user.id: # Примерная оценка по ID registration_year = 2013 + (user.id // 10000000) text += f"\n📅 Примерная дата регистрации: {registration_year} год\n" # Подпись text += f"\n🛸 Neko-chan info" await utils.answer(message, text) async def get_common_chats(self, message, user_id): """Получает список общих чатов""" try: common = [] async for dialog in message.client.iter_dialogs(): if dialog.is_chat or dialog.is_group: try: participants = await message.client.get_participants(dialog.id, limit=100) if any(p.id == user_id for p in participants): common.append(dialog) except: continue return common except: return [] async def whoiscmd(self, message): """[@username или reply] - Кто этот человек?""" args = utils.get_args_raw(message) # Поиск по юзернейму if args: try: if args.startswith('@'): args = args[1:] user = await message.client.get_entity(args) except: await utils.answer(message, "❌ Пользователь не найден") return else: # По реплаю reply = await message.get_reply_message() if reply: user = await reply.get_sender() else: await utils.answer(message, "❌ Укажи юзернейм или ответь на сообщение") return # Показываем информацию await self.uicmd(message) async def idcmd(self, message): """Показать ID пользователя/чата""" reply = await message.get_reply_message() if reply: user = await reply.get_sender() text = f"🆔 ID пользователя: {user.id}\n" else: text = f"🆔 ID чата: {message.chat_id}\n" if message.chat_id: text += f"🆔 Ваш ID: {(await message.client.get_me()).id}" await utils.answer(message, text) async def chatscmd(self, message): """Список чатов где есть пользователь""" reply = await message.get_reply_message() if not reply: await utils.answer(message, "❌ Ответь на сообщение пользователя") return user = await reply.get_sender() status = await utils.answer(message, f"🔍 Ищу чаты где есть @{user.username or user.id}...") common = await self.get_common_chats(message, user.id) if not common: await status.edit("❌ Нет общих чатов") return text = f"💬 Чаты с {user.first_name}:\n\n" for i, chat in enumerate(common[:10], 1): chat_name = chat.title or chat.first_name or "Без названия" chat_type = "Группа" if chat.is_group else "Чат" text += f"{i}. {chat_type} — {chat_name}\n" text += f" ID: {chat.id}\n" if len(common) > 10: text += f"\n...и ещё {len(common) - 10} чатов" await status.edit(text)