Объект TelegramClient не имеет атрибута get_input_peer.
Установлена последняя версия Telethon
Код:
Код: Выделить всё
import asyncio
from telethon import TelegramClient, functions
api_id = ''
api_hash = ''
phone_number = ''
client = TelegramClient('session_name', api_id, api_hash,
device_model="iPhone",
system_version="14.8.1",
app_version="8.4",
lang_code="en",
system_lang_code="en-US")
async def main():
await client.start()
confirmation_code = input('Введите код подтверждения: ')
await client.sign_in(phone_number, confirmation_code)
await client.get_dialogs()
while True:
try:
await client(functions.messages.SaveDraftRequest(
await client.get_input_peer('me'),
'бе',
reply_to_msg_id=None
))
await asyncio.sleep(15)
except Exception as e:
print(f'Ошибка: {e}')
await client.start()
continue
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Подробнее здесь: https://stackoverflow.com/questions/765 ... input-peer
Мобильная версия