Я инициализировал сеанс, пользователь-бот просматривает чаты, но не выводит на консоль чаты, соответствующие требованиям условного Оператор if.
Когда я выполняю:
Код: Выделить всё
async for dialog in app.get_dialogs():
print(dialog.chat)
Код: Выделить всё
{
"_": "Chat",
"id": -4031246626,
"type": "ChatType.GROUP",
"is_creator": true,
"title": "comments",
"has_protected_content": false,
"members_count": 0
}
Код: Выделить всё
async def main():
async with app:
print("[LOG] --- [INFO] ---> The client has Started.")
# Get all dialogs (chats) the user is involved with
try:
async for dialog in app.get_dialogs():
print(dialog.chat)
if dialog.chat.type == "ChatType.PRIVATE":
print(f"Private Chat: {dialog.chat.title} | ID: {dialog.chat.id}")
except Exception as e:
print(f"[LOG] --- [ERROR] ---> {e}")
app.run(main())
Подробнее здесь: https://stackoverflow.com/questions/787 ... channel-ty