Search code examples
pyrogram

Username check Pyrogram IF username =


How can I implement a check for a user? That is, if the message was sent from this user, then: let's send the reaction "❤️" on his message [pyrogram]

I tried to:

@app.on_message(filters.user.id="...")
def reaction(client,message):
    app.send_reaction(message.chat.id, message.id, "❤️")

But not working


Solution

  • That's not how Pyrogram's Filters work. The user filter takes an integer or str, or a list of both. Those represent the UserID as integer, or the username or phone number as string.

    See Pyrogram's Documentation for all filters and their arguments, as well as how to use them:

    @app.on_message(filters.user("username"))
    ...