{"id":24286,"library":"py-tgcalls","title":"py-tgcalls","description":"Async client API for Telegram Calls, enabling voice chat functionality in Telegram bots and clients. Current version 2.2.12, requires Python >=3.10. Released regularly via PyPI.","status":"active","version":"2.2.12","language":"python","source_language":"en","source_url":"https://github.com/pytgcalls/pytgcalls.git","tags":["telegram","voice-chat","calls","pyrogram","telethon","async"],"install":[{"cmd":"pip install py-tgcalls","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Optional extra for Pyrogram integration","package":"pytgcalls[pyrogram]","optional":true},{"reason":"Optional extra for Telethon integration","package":"pytgcalls[telethon]","optional":true}],"imports":[{"note":"Hyphen in package name, but import uses underscore","wrong":"from py_tgcalls import PyTgCalls","symbol":"pytgcalls","correct":"from pytgcalls import PyTgCalls"},{"note":"MediaStream is in pytgcalls.types submodule","wrong":"from pytgcalls import MediaStream","symbol":"MediaStream","correct":"from pytgcalls.types import MediaStream"},{"note":"GroupCallFactory removed in v2","wrong":"GroupCallFactory is deprecated in v2; use PyTgCalls directly","symbol":"GroupCallFactory","correct":"from pytgcalls import GroupCallFactory"}],"quickstart":{"code":"import asyncio\nfrom pyrogram import Client\nfrom pytgcalls import PyTgCalls\nfrom pytgcalls.types import MediaStream\n\napp = Client('my_account', api_id=12345, api_hash='abcdef')\npy_tgcalls = PyTgCalls(app)\n\nasync def main():\n    await py_tgcalls.start()\n    await py_tgcalls.join_group_call(\n        -1001234567890,\n        MediaStream(\n            'https://example.com/audio.ogg',\n        )\n    )\n    await asyncio.Event().wait()\n\napp.run(main())","lang":"python","description":"Basic usage: start a voice chat in a group using Pyrogram and py-tgcalls."},"warnings":[{"fix":"Migrate to PyTgCalls class. See migration guide in GitHub README.","message":"v2.0 dropped GroupCallFactory and changed the entire API. Old v1 code using GroupCallFactory will not work.","severity":"breaking","affected_versions":"<2.0"},{"fix":"Use MediaStream from pytgcalls.types.","message":"MediaStream replaces InputAudioStream and InputVideoStream. These old classes are removed in v2.","severity":"breaking","affected_versions":"<2.0"},{"fix":"Ensure the Pyrogram/Telethon client is started before starting PyTgCalls.","message":"Initializing PyTgCalls with a client that is not logged in or not started will cause runtime errors.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Call await py_tgcalls.leave_group_call(chat_id) before joining again.","cause":"Calling join_group_call when already in a call without leaving first.","error":"pytgcalls.exceptions.AlreadyJoinedError: Already joined to the group call"},{"fix":"Upgrade code to use PyTgCalls class. Remove GroupCallFactory and use PyTgCalls(app).","cause":"Using v1 API (GroupCallFactory) with py-tgcalls v2.","error":"AttributeError: module 'pytgcalls' has no attribute 'GroupCallFactory'"},{"fix":"Do not serialize MediaStream directly. Use it only with join_group_call or change_stream.","cause":"Passing MediaStream to something that expects a dict, e.g., as a message reply.","error":"TypeError: Object of type 'MediaStream' is not JSON serializable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}