Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "participant_list_updated" event #143

Closed
MarshalX opened this issue Aug 22, 2021 · 1 comment · Fixed by #144
Closed

Add "participant_list_updated" event #143

MarshalX opened this issue Aug 22, 2021 · 1 comment · Fixed by #144
Assignees
Labels
enhancement New feature or request Priority 3

Comments

@MarshalX
Copy link
Owner

Should be occurred on MTProto update after comparing with group call instance by call id and so on. Callback should get 2 args: group call instance to easy access to method and filed, wrapped updated participants list.

enum name: PARTICIPANT_LIST_UPDATED.
this event is common so should be related to base GroupCall class

need to extend already existed participant wrapper for bridges

@MarshalX MarshalX added enhancement New feature or request Priority 3 labels Aug 22, 2021
@MarshalX MarshalX self-assigned this Aug 22, 2021
@MarshalX
Copy link
Owner Author

MarshalX commented Aug 22, 2021

Ways to register a callback:

1:

async def participants_are_updated(group_call, participants):
    print(f'Updated participant list: {participants}')

group_call.on_participant_list_updated(participants_are_updated)

2:

@group_call.on_participant_list_updated
async def participants_are_updated(gc, participants):
    print(f'Updated participant list: {participants}')

3:

async def participants_are_updated(gc, participants):
        print(f'Updated participant list: {participants}')

group_call.add_handler(participants_are_updated, GroupCallAction.PARTICIPANT_LIST_UPDATED)

Telethon output:

Updated participant list: [<GroupCallParticipantWrapper>({'peer': <telethon.tl.types.PeerChannel object at 0x10eb4a5b0>, 'date': datetime.datetime(2021, 8, 22, 15, 35, 51, tzinfo=datetime.timezone.utc), 'source': 1382476690, 'muted': True, 'left': False, 'can_self_unmute': True, 'just_joined': False, 'versioned': False, 'min': False, 'muted_by_you': False, 'volume_by_admin': True, 'is_self': False, 'video_joined': False, 'active_date': None, 'volume': None, 'about': '🧑🏻\u200d💻DEV. More info inside...', 'raise_hand_rating': None})]

Pyrogram output:

Updated participant list: [<GroupCallParticipantWrapper>({'peer': pyrogram.raw.types.PeerChannel(channel_id=1359572958), 'date': 1629646551, 'source': 1382476690, 'muted': True, 'left': False, 'can_self_unmute': True, 'just_joined': False, 'versioned': False, 'min': False, 'muted_by_you': False, 'volume_by_admin': True, 'is_self': False, 'video_joined': None, 'active_date': None, 'volume': None, 'about': '🧑🏻\u200d💻DEV. More info inside...', 'raise_hand_rating': None})]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Priority 3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant