и не понял.
если делать через app.send_message(id, text) оно викенет большую ошибку о том что "peer not found"
''' Traceback (most recent call last): File "/home/stnikolas/.local/lib/python3.10/site-packages/pyrogram/methods/advanced/resolve_peer.py", line 60, in resolve_peer return await self.storage.get_peer_by_id(peer_id) File "/home/stnikolas/.local/lib/python3.10/site-packages/pyrogram/storage/sqlite_storage.py", line 147, in get_peer_by_id raise KeyError(f"ID not found: {peer_id}") KeyError: 'ID not found: 1218726031' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/stnikolas/.local/lib/python3.10/site-packages/pyrogram/methods/advanced/resolve_peer.py", line 83, in resolve_peer return await self.storage.get_peer_by_phone_number(peer_id) File "/home/stnikolas/.local/lib/python3.10/site-packages/pyrogram/storage/sqlite_storage.py", line 172, in get_peer_by_phone_number raise KeyError(f"Phone number not found: {phone_number}") KeyError: 'Phone number not found: 1218726031' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/stnikolas/Documents/code/bot_lichilnik/main.py", line 76, in <module> app.run(main()) File "/home/stnikolas/.local/lib/python3.10/site-packages/pyrogram/methods/utilities/run.py", line 51, in run run(coroutine) File "/usr/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete return future.result() File "/home/stnikolas/Documents/code/bot_lichilnik/main.py", line 32, in main await app.send_message("1218726031", messages_to_send[1]) File "/home/stnikolas/.local/lib/python3.10/site-packages/pyrogram/methods/messages/send_message.py", line 130, in send_message peer=await self.resolve_peer(chat_id), File "/home/stnikolas/.local/lib/python3.10/site-packages/pyrogram/methods/advanced/resolve_peer.py", line 85, in resolve_peer raise PeerIdInvalid pyrogram.errors.exceptions.bad_request_400.PeerIdInvalid: Telegram says: [400 PEER_ID_INVALID] - The peer id being used is invalid or not known yet. Make sure you meet the peer before interacting with it '''
Там ещё ссылка идёт, почитай
Трейс полный
pip show pyrogram
Ладно, последняя Тогда вот: https://docs.pyrogram.org/faq/peer-id-invalid-error
Обсуждают сегодня