From e46528829287f1b5aacf0d51a2cbd6d1fbb9a432 Mon Sep 17 00:00:00 2001 From: Aahnik Daw Date: Sun, 16 May 2021 19:30:30 +0530 Subject: [PATCH] Updated Increasing View Count (markdown) --- Increasing-View-Count.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Increasing-View-Count.md b/Increasing-View-Count.md index 3f0e1f0..2b4f729 100644 --- a/Increasing-View-Count.md +++ b/Increasing-View-Count.md @@ -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 )) ``` \ No newline at end of file