Files
Heroku-Modules/ui.py
T
yanistyle 1312cf3d5f Загрузить файлы в «/»
Ищет из открытых источников инфо об человеке
2026-08-31 16:59:53 +03:00

191 lines
7.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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"<b>📋 Информация о пользователе</b>\n\n"
# Основная информация
text += f"<b>👤 Основное:</b>\n"
text += f"├ ID: <code>{user.id}</code>\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<b>📞 Контакты:</b>\n"
if hasattr(user, 'phone') and user.phone:
text += f"├ Телефон: <code>{user.phone}</code>\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<b>📝 О себе:</b>\n"
text += f"├ {bio}\n"
# Фото
if hasattr(full_user, 'photo') and full_user.photo:
text += f"\n<b>🖼 Фото:</b> есть\n"
else:
text += f"\n<b>🖼 Фото:</b> нет\n"
# Общие чаты
text += f"\n<b>💬 Общие чаты:</b>\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<b>📅 Примерная дата регистрации:</b> {registration_year} год\n"
# Подпись
text += f"\n<i>🛸 Neko-chan info</i>"
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"<b>🆔 ID пользователя:</b> <code>{user.id}</code>\n"
else:
text = f"<b>🆔 ID чата:</b> <code>{message.chat_id}</code>\n"
if message.chat_id:
text += f"<b>🆔 Ваш ID:</b> <code>{(await message.client.get_me()).id}</code>"
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"<b>💬 Чаты с {user.first_name}:</b>\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: <code>{chat.id}</code>\n"
if len(common) > 10:
text += f"\n...и ещё {len(common) - 10} чатов"
await status.edit(text)