Skip to content

Commit 9092905

Browse files
committed
Fix:IMP : code fauilure due the updated API in backened (by Telegram itself). By using "client.iter_dialogs()" instead of deprecated "GetAllChatsRequest"....
1. As the "GetAllChatsRequest()" has been deprecated by Telegram. 2. Need to use "client.iter_dialogs()" now for the same purpose of getting the chats. Ref: alik0211/mtproto-core#279 gram-js/gramjs#522
1 parent 095bbb4 commit 9092905

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ logs
55
*.session
66
*.session-journal
77
tmp
8+
*.bak

upload.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import asyncio
22
from telethon import TelegramClient, errors, events
3-
from telethon.tl.functions.messages import GetAllChatsRequest
43
from datetime import datetime, timedelta
54
import sys, os
65

@@ -58,8 +57,7 @@ async def main():
5857
client = TelegramClient('media_downloader', api_id, api_hash)
5958
await client.start()
6059
print("Connected now...")
61-
chats = await client(GetAllChatsRequest(except_ids=[]))
62-
for _, chat in enumerate(chats.chats):
60+
async for chat in client.iter_dialogs(limit = 15):
6361
if chat.title == chat_title:
6462
chat_found = True
6563
print("found chat with title", chat_title)

0 commit comments

Comments
 (0)