Bound Methods

Some Electrogram types define what are called bound methods. Bound methods are functions attached to a type which are accessed via an instance of that type. They make it even easier to call specific methods by automatically inferring some of the required arguments.

from pyrogram import Client

app = Client("my_account")


@app.on_message()
def hello(client, message)
    message.reply("hi")


app.run()

ActiveSession

CallbackQuery

Chat

ChatJoinRequest

Folder

InlineQuery

Message

Poll

PreCheckoutQuery

ShippingQuery

Story

User

UserGift