更新:
在新版本的Telethon中,@ Lonami答案是最好的并使用它。
#########################################
您可以使用此代码获取消息:
client = TelegramClient('session_name', api_id, api_hash, update_workers=1, spawn_read_thread=False)assert client.connect()if not client.is_user_authorized(): client.send_pre_request(phone_number) me = client.sign_in(phone_number, input('Enter pre: '))channel_username='tehrandb' # your channelchannel_entity=client.get_entity(channel_username)posts = client(GetHistoryRequest( peer=channel_entity, limit=100, offset_date=None, offset_id=0, max_id=0, min_id=0, add_offset=0, hash=0))# messages stored in `posts.messages`


