Код: Выделить всё
from telethon.tl.types import User
from telethon.helpers import TotalList
from telethon import TelegramClient, sync
class Crawler:
def __init__(self, fetch: bool):
self._client = TelegramClient('some_name', my_api_id, 'my_secret_api_hash')
self._me = self._client.start(phone='my_phone_number', password='my_2fa_password')
if fetch:
self.get_open_dialogs()
def get_open_dialogs(self):
if self._me:
Crawler.filter_open_dialogs(self._me.get_dialogs(), [])
return self._me.get_dialogs()
@staticmethod
def filter_open_dialogs(dialogs: TotalList, filter_list: list):
result = []
if dialogs and dialogs.total:
for dialog in dialogs:
entity = dialog.entity
if not isinstance(entity, User) and entity.id not in filter_list:
result.append(entity)
return result
Ожидаемый тип TotalList', вместо этого получено 'Coroutine'...
Есть мысли, что происходит не так?>
Подробнее здесь: https://stackoverflow.com/questions/521 ... -type-hint
Мобильная версия