Advertisement
disk6969

Untitled

Feb 14th, 2024 (edited)
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. app.start()
  2.  
  3. dialogs = []
  4.  
  5. async def getArchived():
  6. limit: int = 0
  7. offset_date = 0
  8. offset_id = 0
  9. offset_peer = pyrogram.raw.types.InputPeerEmpty()
  10. return await app.invoke(raw.functions.messages.GetDialogs(offset_date=offset_date, offset_id=offset_id, offset_peer=offset_peer, limit=limit, hash=0, folder_id=1), sleep_threshold=60)
  11.  
  12. async def main():
  13. i = 0
  14. r = await getArchived()
  15. chats = {i.id: i for i in r.chats}
  16. users = {i.id: i for i in r.users}
  17. print("ARCHIVED:")
  18. for item in r.dialogs:
  19. try:
  20. dialog = pyrogram.types.Dialog._parse(app, item, {}, users, chats)
  21. print(dialog.chat.id, dialog.chat.type.value, item.folder_id)
  22. dialogs.append(dialog)
  23. except Exception as e:
  24. print(type(e).__name__, e)
  25. print("TOTAL:")
  26. for dialog in dialogs:
  27. print(dialog.chat.title or dialog.chat.first_name)
  28. i += 1
  29. print(i)
  30.  
  31. app.loop.run_until_complete(main())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement