📜  offset_id - 任何代码示例

📅  最后修改于: 2022-03-11 14:55:52.149000             🧑  作者: Mango

代码示例1
import asyncio
from telethon import TelegramClient
from telethon.tl import functions, types

client = TelegramClient('YOUR_SESSION_NAME', 'YOUR_API_ID', 'YOUR_API_HASH')
client.start()

async def main():
    channel = await client.get_entity('CHANNEL USERNAME')
    messages = await client.get_messages(channel, limit= None) #pass your own args

    #then if you want to get all the messages text
    for x in messages:
        print(x.text) #return message.text


loop = asyncio.get_event_loop()
loop.run_until_complete(main())