Updated Increasing View Count (markdown)

Aahnik Daw 2021-05-16 19:30:30 +05:30
parent f77edf178c
commit e465288292

@ -1,12 +1,15 @@
It has been asked [quite](https://github.com/LonamiWebs/Telethon/issues/233) [a few](https://github.com/LonamiWebs/Telethon/issues/305) [times](https://github.com/LonamiWebs/Telethon/issues/409) (really, [many](https://github.com/LonamiWebs/Telethon/issues/447)), and while I don't understand why so many people ask this, the solution is to use [`GetMessagesViewsRequest`](https://lonamiwebs.github.io/Telethon/methods/messages/get_messages_views.html), setting `increment=True`:
```python
from telethon.sync import TelegramClient,functions
# Obtain `channel' through dialogs or through client.get_entity() or anyhow.
# Obtain `msg_ids' through `.get_message_history()` or anyhow. Must be a list.
CHANNEL = "channel_username" # Obtain `channel' through dialogs or through client.get_entity() or anyhow.
MSG_IDS = [] # Obtain `msg_ids' through `.get_message_history()` or anyhow. Must be a list.
client(GetMessagesViewsRequest(
peer=channel,
id=msg_ids,
client = TelegramClient("telethon", API_ID, API_HASH).start(phone="xxx")
client(functions.messages.GetMessagesViewsRequest(
peer=CHANNEL,
id=MSG_IDS,
increment=True
))
```