'How can I comment on a post in a telegram channel (WTelegramClient)?

How can I comment on a post in a channel using WTelegramClient? I didn't find anything similar in the examples. If possible, could you provide an example of sending a comment to a specific post in a channel. https://github.com/wiz0u/WTelegramClient



Solution 1:[1]

Searching for "comment" in the full API Methods list, you would quickly find 4 methods dealing with message threads.
And in particular messages.getDiscussionMessage seems interesting as it matches a channel message with the corresponding message within the discussion/comment group associated with the channel.

Once you have that group message, you simply have to reply to it in that group.

    // This part is just to target the last message of a channel
    var channel = await client.Contacts_ResolveUsername("channelName");
    var peerDialogs = await client.Messages_GetPeerDialogs(new[] { new InputDialogPeer() { peer = channel } });
    int msg_id = peerDialogs.dialogs[0].TopMessage;

    // Find the matching discussion group message and reply to it:
    var discussion = await client.Messages_GetDiscussionMessage(channel, msg_id);
    var groupMsg = discussion.messages[0];
    await client.SendMessageAsync(discussion.chats[groupMsg.Peer.ID], "test", reply_to_msg_id: groupMsg.ID);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Wizou