mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-29 12:53:44 +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`:
|
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
|
```python
|
||||||
|
from telethon.sync import TelegramClient,functions
|
||||||
|
|
||||||
# Obtain `channel' through dialogs or through client.get_entity() or anyhow.
|
CHANNEL = "channel_username" # Obtain `channel' through dialogs or through client.get_entity() or anyhow.
|
||||||
# Obtain `msg_ids' through `.get_message_history()` or anyhow. Must be a list.
|
MSG_IDS = [] # Obtain `msg_ids' through `.get_message_history()` or anyhow. Must be a list.
|
||||||
|
|
||||||
client(GetMessagesViewsRequest(
|
client = TelegramClient("telethon", API_ID, API_HASH).start(phone="xxx")
|
||||||
peer=channel,
|
|
||||||
id=msg_ids,
|
client(functions.messages.GetMessagesViewsRequest(
|
||||||
|
peer=CHANNEL,
|
||||||
|
id=MSG_IDS,
|
||||||
increment=True
|
increment=True
|
||||||
))
|
))
|
||||||
```
|
```
|
Loading…
Reference in New Issue
Block a user