пример сбора пользователей:
async def dump_all_participants(channel, namefile):
offset_user = 0
limit_user = 100
all_participants = []
filter_user = ChannelParticipantsSearch('')
while True:
participants = await client(GetParticipantsRequest(channel,
filter_user, offset_user, limit_user, hash=0))
if not participants.users:
break
all_participants.extend(participants.users)
offset_user += len(participants.users)
all_users_details = []
for participant in all_participants:
all_users_details.append({"id":
participant.id,
"first_name": participant.first_name,
"last_name": participant.last_name,
"user": participant.username,
"phone":
participant.phone,
"is_bot":
participant.bot})
with open('channel_users'+namefile+'.json', 'w', encoding='utf8') as outfile:
json.dump(all_users_details, outfile, ensure_ascii=False)