S
S
Sergey2021-05-29 19:08:33
Python
Sergey, 2021-05-29 19:08:33

How to call a piece of code in the pyrogram library if you have been added to a new group?

I'm using the pyrogram library to automate the download of files from groups I'm added to. My first task is to make a call to add to a new chat. I tried using the @app.on_chat_member_updated() call , however, my code didn't do anything when adding me or someone else to the group. My question is this: Is it possible to implement this call in any way, but only so that it works when adding me to the chat, and does nothing when adding the rest?

My code:

from pyrogram import Client
import pyrogram
from pyrogram.handlers import chat_member_updated_handler

app = Client(
    "my_account",
    api_id=api_id,
    api_hash=api_hash
)

@app.on_chat_member_updated()
def log(client, message):
    print(f'{message}\n\n{client}')

app.run()

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question