I have some function for marking archived dialogs as read in my telegram account, but it doesn’t work if this dialog is megagroup. I suspect there is no way to do it, if it not, please help me
@client.on(events.NewMessage(incoming=True))
async def mark_archived_dialogs_as_read(event):
async for dialog in client.iter_dialogs(archived=True):
if event.message.message == dialog.message.message:
if isinstance(event.peer_id, types.PeerChat):
await client.send_read_acknowledge(entity=await client.get_entity(dialog.name),
max_id=event.message.id,
clear_mentions=True,
clear_reactions=True,
)
elif isinstance(event.peer_id, types.PeerChannel):
entity = await client.get_entity(dialog.name)
if entity.megagroup:
await client.send_read_acknowledge(entity=entity,
max_id=event.message.id,
clear_mentions=True,
clear_reactions=True,
)
else:
await client.send_read_acknowledge(entity=entity,
max_id=event.message.id,
clear_mentions=True,
clear_reactions=True,
)
My function can see any message in megagroups, but what haven’t I tried it doesn’t work
New contributor
VYBIG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.