async def _change_volume_voice_call(self, request: BaseRequest):
        result_json = {
            'result': 'ACCESS_DENIED',
        }
        params = await request.json()
        if isinstance(params, str):
            params = json.loads(params)
        if params['session_id'] == self.pytgcalls._session_id:
            # noinspection PyBroadException
            try:
                chat_call = (await self.pytgcalls._load_full_chat(
                    params['chat_id'], )).full_chat.call
                await self.pytgcalls._app.send(
                    EditGroupCallParticipant(
                        call=chat_call,
                        participant=self.pytgcalls._cache_user_peer[
                            int(params['chat_id']), ],
                        muted=False,
                        volume=params['volume'] * 100,
                    ), )

                result_json = {
                    'result': 'OK',
                }
            except Exception:
                pass
        return web.json_response(result_json)
    async def _change_volume_voice_call(self, params: dict):
        result_json = {
            'result': 'ACCESS_DENIED',
        }
        if params['session_id'] == self.pytgcalls._session_id:
            # noinspection PyBroadException
            try:
                chat_call = await self.pytgcalls._load_chat_call(
                    params['chat_id'],
                )
                await self.pytgcalls._app.send(
                    EditGroupCallParticipant(
                        call=chat_call,
                        participant=self.pytgcalls._cache_user_peer[
                            int(params['chat_id'])
                        ],
                        muted=False,
                        volume=params['volume'] * 100,
                    ),
                )

                result_json = {
                    'result': 'OK',
                }
            except Exception:
                pass
        return result_json
Exemplo n.º 3
0
 async def change_volume(
     self,
     chat_id: int,
     volume: int,
     participant: InputPeer,
 ):
     chat_call = await self._cache.get_full_chat(chat_id)
     if chat_call is not None:
         await self._app.send(
             EditGroupCallParticipant(
                 call=chat_call,
                 participant=participant,
                 muted=False,
                 volume=volume * 100,
             ), )
Exemplo n.º 4
0
 async def set_video_call_status(
     self,
     chat_id: int,
     stopped_status: Optional[bool],
     paused_status: Optional[bool],
     participant: InputPeer,
 ):
     chat_call = await self._cache.get_full_chat(chat_id)
     if chat_call is not None:
         await self._app.send(
             EditGroupCallParticipant(
                 call=chat_call,
                 participant=participant,
                 muted=False,
                 video_stopped=stopped_status,
                 video_paused=paused_status,
             ), )
Exemplo n.º 5
0

async def manage_vcmember(message: Message, to_mute: bool):
    if not (group_call := (await get_group_call(message))):
        return
    peer_ = None
    if not await vc_member(message, group_call):
        return
    if message.input_str:
        peer_ = message.input_str.strip()
    elif message.reply_to_message and message.reply_to_message.text:
        peer_ = message.reply_to_message.text
    if peer_ and (user_ := (await append_peer_user([peer_]))):
        await userge.send(
            EditGroupCallParticipant(call=group_call,
                                     user_id=user_[0],
                                     muted=to_mute))
        await message.edit(
            str(user_[0].user_id) +
            (" **Muted** " if to_mute else " **Unmuted** ") + "succesfully",
            del_in=5,
        )


async def get_group_call(message: Message,
                         err_msg: str = "") -> Optional[InputGroupCall]:
    chat_peer = await userge.resolve_peer(message.chat.id)
    if isinstance(chat_peer, (InputPeerChannel, InputPeerChat)):
        if isinstance(chat_peer, InputPeerChannel):
            full_chat = (await userge.send(GetFullChannel(channel=chat_peer)
                                           )).full_chat