S
S
s1veme2020-09-03 18:46:31
Python
s1veme, 2020-09-03 18:46:31

Error when parsing participants in a telegram asynchronously?

parse.py:

from pyrogram import Client

async def user_chat(): 
    app = Client("my_account", api_id=INT, api_hash="STR")

    more_users = []
    with app: 
        for member in app.iter_chat_members(INT):
            print(member)
            id_user = member.user.id
            more_users.append(id_user)
            username = member.user.first_name
    return more_users


main.py:
@dp.message_handler(content_types="new_chat_members")
async def add_chat_bot(message: types.Message):
    bot_id = INT
    title_chat = str(message.chat.title)
    for user in message.new_chat_members:
        if user.id == bot_id:
            await parse.user_chat()


Mistake:
for member in app.iter_chat_members(INT):
TypeError: 'async_generator' object is not iterable


How to fix?
All data were specifically replaced with data types - everything is in place in the code.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2020-09-03
@aleksegolubev

ok Google, "TypeError: 'async_generator' object is not iterable"
PS never happened and here again, we don't know python well, but we also want to use async.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question