Created
August 13, 2023 15:16
-
-
Save hugmouse/41e29937f11e9b3c989f1af36f319c2d to your computer and use it in GitHub Desktop.
Just iterates over your dialogs in Telegram and prints the name of the dialog and it's ID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
from pyrogram import Client | |
# Replace with your API credentials | |
api_id = 1 | |
api_hash = '1' | |
async def main(): | |
async with Client("chat_iterator", api_id, api_hash) as app: | |
async for dialog in app.get_dialogs(): | |
print(dialog.chat.title or dialog.chat.first_name, dialog.chat.id) | |
asyncio.run(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment