With telethon is it possible to forward a message to a group topic?


There is nothing in the documentation about forwarding or sending messages to topic.

I have tried using client.forward_messages but, since there’s nothing in the documentation about topics, I was left flailing and guessing what might work. E.g.:

await client.send_message(
    if (0x10000 <= ord(x) <= 0x10FFFF) else x for x in text
TypeError: ord() expected a character, but string of length 2 found
Asked By: jackwalton



The friendly client.forward_messages method does not yet expose a way to forward messages to a specific topic. However, you can use ForwardMessagesRequest directly like so:

from telethon import TelegramClient, functions

client = TelegramClient(...)

    from_peer=source_chat,     # <- chat where the messages exist
    id=[123, 456],             # <- message ids to forward from source_chat
    to_peer=destination_chat,  # <- where to forward the messages
    top_msg_id=topic_id,       # <- topic id
Answered By: Lonami
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.