Search code examples
pythontelegrampyrogram

How properly use functions in pyrogram?


Sometimes when I use functions in pyrogram I receive the following output:

{
    "_": functionName,
    "argName" : value,
    "arg2Name" : value2,
    # etc.
}

For instance, If I write:

functions.users.GetFullUser(types.InputUserSelf())

I receive:

{
    "_": "functions.users.GetFullUser",
    "id": {
        "_": "types.InputUserSelf"
    }
}

Why do I receive this result? How should I properly use the functions?


Solution

  • You should use send():

    from pyrogram import Client
    from pyrogram.api import functions
    
    app = Client("test")
    result = app.send(functions.users.GetFullUser(types.InputUserSelf()))
    print(result)