# Moon-Userbot - telegram userbot # Copyright (C) 2020-present Moon Userbot Organization # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . from pyrogram import Client, filters from pyrogram.raw import functions from pyrogram.types import Message from utils.misc import modules_help, prefix from utils.scripts import format_exc, interact_with, interact_with_to_delete @Client.on_message(filters.command("inf", prefix) & filters.me) async def get_user_inf(client: Client, message: Message): if len(message.command) >= 2: peer = await client.resolve_peer(message.command[1]) elif message.reply_to_message and message.reply_to_message.from_user: peer = await client.resolve_peer(message.reply_to_message.from_user.id) else: peer = await client.resolve_peer("me") response = await client.invoke(functions.users.GetFullUser(id=peer)) user = response.users[0] full_user = response.full_user if user.username is None: username = "None" else: username = f"@{user.username}" about = "None" if full_user.about is None else full_user.about user_info = f"""|=Username: {username} |-Id: {user.id} |-Bot: {user.bot} |-Scam: {user.scam} |-Name: {user.first_name} |-Deleted: {user.deleted} |-BIO: {about} """ await message.edit(user_info) @Client.on_message(filters.command("inffull", prefix) & filters.me) async def get_full_user_inf(client: Client, message: Message): await message.edit("Receiving the information...") try: if len(message.command) >= 2: peer = await client.resolve_peer(message.command[1]) elif message.reply_to_message and message.reply_to_message.from_user: peer = await client.resolve_peer(message.reply_to_message.from_user.id) else: peer = await client.resolve_peer("me") response = await client.invoke(functions.users.GetFullUser(id=peer)) user = response.users[0] full_user = response.full_user await client.unblock_user("@creationdatebot") try: response = await interact_with( await client.send_message("creationdatebot", f"/id {user.id}") ) except RuntimeError: creation_date = "None" else: creation_date = response.text # await client.delete_messages("@creationdatebot", interact_with_to_delete) interact_with_to_delete.clear() if user.username is None: username = "None" else: username = f"@{user.username}" about = "None" if full_user.about is None else full_user.about user_info = f"""|=Username: {username} |-Id: {user.id} |-Account creation date: {creation_date} |-Bot: {user.bot} |-Scam: {user.scam} |-Name: {user.first_name} |-Deleted: {user.deleted} |-BIO: {about} |-Contact: {user.contact} |-Can pin message: {full_user.can_pin_message} |-Mutual contact: {user.mutual_contact} |-Access hash: {user.access_hash} |-Restricted: {user.restricted} |-Verified: {user.verified} |-Phone calls available: {full_user.phone_calls_available} |-Phone calls private: {full_user.phone_calls_private} |-Blocked: {full_user.blocked}""" await message.edit(user_info) except Exception as e: await message.edit(format_exc(e)) modules_help["user_info"] = { "inf [reply|id|username]": "Get brief information about user", "inffull [reply|id|username": "Get full information about user", }