Last active
June 12, 2022 17:32
-
-
Save SHi-ON/f5121853ce59280d96e0ce2f8aa1a91f to your computer and use it in GitHub Desktop.
List Telegram chats (including Super Groups and Channels) of your own.
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
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