1

How can I:

  • Get a public channel message history [Text, Photo, Video ...]
  • Mark these messages as a viewed

With Telethon (python), we can use this method:

for message in client.get_messages(channel, limit=int(count)):
                result = client(functions.messages.GetMessagesViewsRequest(peer=channel,id=[message.id],increment=True))

I want a method like this on WTelegramClient in c#

Erçin Dedeoğlu
  • 4,950
  • 4
  • 49
  • 69

1 Answers1

2

If I understand correctly, you want to get a list of messages (history) from a channel and increment the views counter for each.

⚠️ From the official documentation: If you use the Telegram API for flooding, spamming, faking subscribers, and view counters of channels, you will be banned forever.

The equivalent of your code with WTelegramClient would be something like this:

var msgs = await client.Messages_GetHistory(channel, limit: count);
foreach (var message in msgs.Messages)
    await client.Messages_GetMessagesViews(channel, new[] { message.ID }, true);

// possible alternate way (single API call):
await client.Messages_GetMessagesViews(channel, msgs.Messages.Select(m => m.ID).ToArray(), true);

See EXAMPLES.md for detailed examples of fetching chat history.

Erçin Dedeoğlu
  • 4,950
  • 4
  • 49
  • 69
Wizou
  • 1,336
  • 13
  • 24