Voice chats, private incoming and outgoing calls in Telegram for Developers
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(group_call, participants):
print(f'Updated participant list: {participants}')
3:
async def participants_are_updated(group_call, participants):
print(f'Updated participant list: {participants}')
group_call.add_handler(participants_are_updated, GroupCallAction.PARTICIPANT_LIST_UPDATED)
Telethon:
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:
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})]
You are able to install library on Windows without WSL now. The dependencies have been updated to the latest versions. The updated Telegram tgcalls now has the ability to work with group video calls. Wait for the next major update. A lot of work has been done in this update to improve communication between Python and C++ tgcalls via binding. Fixed all problems with pointers. C++ native instances are now fully deconstructed correctly.
RuntimeError
now. New exceptions: PytgcallsError
, CallBeforeStartError
, NotConnectedError
, GroupCallNotFoundError
;set_is_mute
method is async now. You need to call it with await
statement;isGroupCallStarted
native method was renamed to isGroupCallNativeCreated
.print_available_playout_devices
and print_available_recording_devices
methods of GroupCall
now deprecated and will be removed soon;get_playout_devices
and get_recording_devices
methods to get information about system audio devices (names and guids);outgoing_audio_bitrate_kbit
argument in constructor of GroupCallFactory
);stopAudioDeviceModule
, startAudioDeviceModule
);pre_update_processing
to join_group_call
with setting ssrc before handling of updates;Happy coding ❤️
Now pytgcalls supports both the most popular MTProto clients! Pyrogram and Telethon ✨
Starting from 1.0.0 you are able to implement your own MTProto bridges as easy as you wish!
Starting from installing the library, you need to choose with which client you will work.
For Pyrogram:
pip3 install pytgcalls[pyrogram]
For Telethon:
pip3 install pytgcalls[telethon]
Of course, you can manually install requires, but please pay your attention to minimal required version of these libs.
GroupCall
instancesNow we have one class called GroupCallFactory
to create GroupCall
instances of any types. You can find examples of new way in this discussion: https://github.com/MarshalX/tgcalls/discussions/101
Q: Will previous code base work with new version of library? A: Everything is individual. I made backward compatibility for the old code, which will notify the user about outdated ways of creating instances, but this will not save you from dirty hacks that could be used in your code.
Q: How to use this library with Telethon? A: We already have a code snippet in the main README file. Also, we have pretty and simple examples what works with Telethon too!
Q: What was done in this version? A: In this version was optimized requests to MTProto, reworked system of connection, reconnection and disconnection. Now you can stop connection at any time and so on. Was added working with default_join_as value. Was fixed several bugs.
Happy coding ❤️