from telethon.sync import TelegramClient
api_id = '?????'
api_hash = '????????'
with TelegramClient('sync', api_id, api_hash) as client:
chat_entity = client.get_entity('https://t.me/new_ton_news')
for message in client.iter_messages(chat_entity):
print(message.sender_id, ':', message.text)
telethon.errors.rpcerrorlist.BotMethodInvalidError: The API access for bot users is restricted. The method you tried to invoke cannot be executed as a bot (caused by GetHistoryRequest)
New contributor
Твоя мама is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.