mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-25 19:03:46 +03:00
Updated Increasing View Count (markdown)
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
|
||||
))
|
||||
```
|
Loading…
Reference in New Issue
Block a user