Exemple #1
0
 async def handle_matrix_about(self, sender: 'u.User', about: str) -> None:
     if self.peer_type not in ("chat", "channel"):
         return
     peer = await self.get_input_entity(sender)
     await sender.client(EditChatAboutRequest(peer=peer, about=about))
     self.about = about
     self.save()
Exemple #2
0
async def update_profile_bio(event):

    split_text = event.text.split(None, 1)
    print(split_text)
    return
    if len(split_text) == 1:
        await client.update_message(event, CABOUT_HELP)
        return

    about = split_text[1]
    chat = await event.get_chat()

    if not chat.admin_rights or not chat.creator:
        await client.update_message(
            event, "`Chat admin privileges are required to do that`")
        return

    if len(about) > 255:
        await client.update_message(event, "`Channel about is too long.`")

    else:
        try:
            await client(EditChatAboutRequest(chat.id, about))
            await client.update_message(event,
                                        "`Succesfully changed chat about`")

        except Exception as exc:
            if isinstance(exc, errors.ChatAboutNotModifiedError):
                await client.update_message(event,
                                            "`About text has not changed.`")

            if isinstance(exc, errors.ChatNotModifiedError):
                await client.update_message(event,
                                            "`The chat wasn't modified`")
 async def handle_matrix_about(self, sender: 'u.User', about: str,
                               event_id: EventID) -> None:
     if self.peer_type not in ("chat", "channel"):
         return
     peer = await self.get_input_entity(sender)
     await sender.client(EditChatAboutRequest(peer=peer, about=about))
     self.about = about
     await self.save()
     await self._send_delivery_receipt(event_id)
Exemple #4
0
async def update_profile_bio(e):
    about = e.pattern_match.group(1)
    chat = await e.get_chat()
    if len(about) > 255:
        await e.edit("`Channel about is too long.`")

    else:
        try:
            await client(EditChatAboutRequest(chat.id, about))
            await e.edit("`Succesfully changed chat about`")

        except Exception as exc:
            if isinstance(exc, errors.ChatAboutNotModifiedError):
                await e.edit("`About text has not changed.`")

            if isinstance(exc, errors.ChatAdminRequiredError):
                await e.edit("`Chat admin privileges are required to do that`")

            if isinstance(exc, errors.ChatNotModifiedError):
                await e.edit("`The chat wasn't modified`")