msg.mark_read() is not working for messages in topics
Code that causes the issue
@client.on(events.NewMessage(chats=junk_list, incoming=True))
async def handler(event):
msg = event.message
print(f"{event.chat_id}: {msg.message}") # debug
try:
await msg.mark_read()
print(f"Marked message {msg.id} as read")
except Exception as e:
print(f"Failed to mark message as read: {e}")
Expected behavior
The try block is executed and the "Marked message as read" print is happening. In fact, the messages that are processed in that code are marked as read, except...
Actual behavior
...except if they belonging to a Group "Topic". Then nothing happens.
Traceback
No response
Telethon version
1.40.0
Python version
3.7.4
Operating system (including distribution name and version)
It's a docker image. python:3.7.4-buster
Other details
I actually am not certain that the error is in the library's code and not my own. According to what I could find in the documentation, the message should be marked as read as I could not find any specifications or exceptions about messages in topics.
Checklist
- [x] The error is in the library's code, and not in my own.
- [x] I have searched for this issue before posting it and there isn't an open duplicate.
- [x] I ran
pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zipand triggered the bug in the latest version.
AFAIK topic messages aren't really different from others. You may try using the raw API to confirm whether it's a bug in the implementation of the library, or something with Telegram.