Skip to content

Instantly share code, notes, and snippets.

@SHi-ON
Last active June 12, 2022 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SHi-ON/f5121853ce59280d96e0ce2f8aa1a91f to your computer and use it in GitHub Desktop.
Save SHi-ON/f5121853ce59280d96e0ce2f8aa1a91f to your computer and use it in GitHub Desktop.
List Telegram chats (including Super Groups and Channels) of your own.
from pyrogram import Client
with Client(CLIENT_NAME, API_ID, API_HASH) as client:
chats = []
for d in client.get_dialogs():
if d.chat.is_creator or \
(d.chat.permissions and d.chat.permissions.can_change_info):
chats.append(d.chat.title)
print(*chats, sep='\n')
print('\t Chat count:', len(chats))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment