skip to Main Content

I am using telethon to handle a client on a custom app. What I would like to do is show the list of people subscribed to a certain telegram channel. Here is the setup:

from telethon import TelegramClient, events, sync

api_id = 8045283
api_hash = 'ad63dec5ee12u8baca534620d5b3d725' #not real btw
client = TelegramClient('name', api_id, api_hash)
await client.start()

After this I have tried functions like client.get_participants(channel), which returns the error:

ChatAdminRequiredError: Chat admin privileges are required to do that in the specified chat (for example, to send a message in a channel which is not yours), or invalid permissions used for the channel or group (caused by GetParticipantsRequest)

And also await client(GetFullChannelRequest(channel=channel)), which just doesn’t have the required information.

I thought that this API was created exactly to create custom clients, but how is this possible if basic functionality cannot be implemented? Can anyone give a suggestion on how to achieve this? Maybe another way of getting such data?

2

Answers


  1. Chosen as BEST ANSWER

    Okay, so I have actually confused terminology here. Telegram does not show the participant of the channel even on the official app (if you are not an admin), however, for Groups the get_participants method works great


  2. async for dialog in client.iter_dialogs():
            if  dialog.is_channel:
           
                print( dialog.entity.participants_count)
    

    this is how you can get participants count without being an admin

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search