示例#1
0
async def _on_raw(_, m: BaseMessage, *__) -> None:
    if isinstance(m, UpdateGroupCallParticipants):
        # TODO: chat_id
        for participant in m.participants:
            if participant.is_self:
                group_call = await userge.send(
                    GetGroupCall(call=InputGroupCall(
                        access_hash=m.call.access_hash, id=m.call.id),
                                 limit=1))
                if participant.just_joined:
                    await _on_join(group_call.call)
                elif participant.left:
                    await _on_left(group_call.call)
                break
    raise ContinuePropagation
示例#2
0
 async def get_call(
     self,
     chat_id: int,
 ) -> Optional[InputGroupCall]:
     chat = await self._app.resolve_peer(chat_id)
     if isinstance(chat, InputPeerChannel):
         input_call = (await self._app.send(
             GetFullChannel(channel=InputChannel(
                 channel_id=chat.channel_id,
                 access_hash=chat.access_hash,
             ), ), )).full_chat.call
     else:
         input_call = (await self._app.send(
             GetFullChat(chat_id=chat.chat_id), )).full_chat.call
     if input_call is not None:
         call: GroupCall = (await self._app.send(
             GetGroupCall(
                 call=input_call,
                 limit=-1,
             ), )).call
         if call.schedule_date is not None:
             return None
     return input_call
示例#3
0
    "vc_info",
    about={
        "header": "Voice Chat info",
        "examples": "{tr}vc_info",
        "flags": {
            "-d": "Detailed User info"
        },
    },
    allow_channels=False,
    allow_private=False,
    allow_via_bot=False,
)
async def vcinfo_(message: Message):
    if not (group_call := (await get_group_call(message))):
        return
    gc_data = await userge.send(GetGroupCall(call=group_call))
    gc_info = {}
    gc_info["ℹ️ INFO"] = clean_obj(gc_data.call, convert=True)
    if len(gc_data.users) != 0:
        if "-d" in message.flags:
            gc_info["👥 Participants"] = [
                clean_obj(x, convert=True) for x in gc_data.participants
            ]
        else:
            gc_info["👥 Users"] = [{
                "Name": x.first_name,
                "ID": x.id
            } for x in gc_data.users]
    await message.edit_or_send_as_file(
        text="🎙  **Voice Chat**\n\n" + yamlify(gc_info),
        filename="group_call.yaml",
示例#4
0
async def vc_member(m: Message, gc: InputGroupCall) -> bool:
    gc_info = await userge.send(GetGroupCall(call=gc))
    if p := getattr(gc_info, "participants", None):
        for x in p:
            if x.peer.user_id == m.from_user.id:
                return True