i am working with an app and it needs to read direct messages from telegram when they arrive.
i searched on google but all i got was how to send a message not how to read brand new dms. Thanks!
Telethon: Make sure you read the basics in the Docs to understand how to handle events.
I'm assuming you meant "mark as read", if not, read the docs, else read below:
in the event object you get to your callback, you have multiple unique convenience methods, and all the ones available on a Message
object, one of them is event.mark_read()
to limit it only to send read requests to private chats; configure handler as needed, a minimal example:
@client.on(events.NewMessage(func=lambda e: e.is_private))
async def read_it_callback(event):
await event.mark_read()
you can also use client.send_read_acknowledge()