I want to get admins of Telegram groups, I try with this code but I get empty response, my code
client.connect()
if not client.is_user_authorized():
client.send_code_request(phone)
client.sign_in(phone, input('Enter the code: '))
result = client(functions.channels.GetParticipantsRequest(
channel='mychannel',
filter=types.ChannelParticipantsAdmins(),
offset=42,
limit=100,
hash=0
))
print(result.stringify())
this is my response I’ve got
ChannelParticipants(
count=1,
participants=[
],
users=[
]
)
3
Answers
Try passing the value 1 to the offset argument
As per the client reference, you can use
client.iter_participants
to iterate over the participants of a group. Furthermore, you can use thefilter
parameter to narrow down the results. The documentation also includes this example:I know your question is for long time ago, but still maybe someone had same question.
Answer:
your code is correct and return all admins of channel. and it have only 1 admin (showen by ‘count=1’ in your result).
but you set ‘offset’ parameter to 42, but it has only 1 admin. so it show empty result.
if your channel had let say 50 admins (indexing 0-49), by setting ‘offset’ to 42 it shows you from index 42 to 49.