Перейти к содержанию

Модели

User

User

User(fields)

Bases: Page, Generic[FieldsTypevar]

Source code in vkflow\base\wrapper.py
def __init__(self, fields: dict) -> None:
    self._fields = fields

Group

Group

Group(fields)

Bases: Page

Source code in vkflow\base\wrapper.py
def __init__(self, fields: dict) -> None:
    self._fields = fields

Page

Page

Page(fields)

Bases: Wrapper, ABC

Source code in vkflow\base\wrapper.py
def __init__(self, fields: dict) -> None:
    self._fields = fields

mention

mention(alias=None)

Создает упоминание пользователя либо с alias либо с его именем

Source code in vkflow\models\page.py
def mention(self, alias: str | None = None) -> str:
    """
    Создает упоминание пользователя либо с `alias` либо с его именем
    """
    if alias:
        updated_alias = format(self, alias)
        mention = f"[{self._mention_prefix}{self.id}|{updated_alias}]"
    else:
        mention = f"[{self._mention_prefix}{self.id}|{self.fullname}]"

    return mention

Message

Message

Message(fields)

Bases: TruncatedMessage

Source code in vkflow\base\wrapper.py
def __init__(self, fields: dict) -> None:
    self._fields = fields

fetch_photos async

fetch_photos(api)

Возвращает только фотографии из всего, что есть во вложениях, оборачивая их в обертку

Source code in vkflow\models\message.py
async def fetch_photos(self, api: API) -> list[Photo]:
    """
    Возвращает только фотографии из всего,
    что есть во вложениях, оборачивая их в обертку
    """
    return [
        Photo(attachment["photo"])
        for attachment in await self.fetch_attachments(api)
        if attachment["type"] == "photo"
    ]

fetch_docs async

fetch_docs(api)

Возвращает только вложения с типом документ из всего, что есть во вложениях, оборачивая их в обертку

Source code in vkflow\models\message.py
async def fetch_docs(self, api: API) -> list[Document]:
    """
    Возвращает только вложения с типом документ из всего,
    что есть во вложениях, оборачивая их в обертку
    """
    if self.is_cropped:
        await self.extend(api)

    return [
        Document(attachment["doc"])
        for attachment in await self.fetch_attachments(api)
        if attachment["type"] == "doc"
    ]

SentMessage

SentMessage dataclass

SentMessage(api, truncated_message)

upload_doc async

upload_doc(
    content,
    filename,
    *,
    tags=None,
    return_tags=None,
    type="doc"
)

Загружает документ для отправки в сообщение

Parameters:

Name Type Description Default
content str | bytes

Содержимое документа. Документ может быть как текстовым, так и содержать сырые байты

required
filename str

Имя файла

required
tags str | None

Теги для файла, используемые при поиске

None
return_tags bool | None

Возвращать переданные теги при запросе

None
type Literal['doc', 'audio_message', 'graffiti']

Тип документа: файл/голосовое сообщение/граффити

'doc'

Returns:

Type Description
Document

Враппер загруженного документа. Этот объект можно напрямую

Document

передать в поле attachments при отправке сообщения

Source code in vkflow\models\message.py
async def upload_doc(
    self,
    content: str | bytes,
    filename: str,
    *,
    tags: str | None = None,
    return_tags: bool | None = None,
    type: typing.Literal["doc", "audio_message", "graffiti"] = "doc",
) -> Document:
    """
    Загружает документ для отправки в сообщение

    Arguments:
        content: Содержимое документа. Документ может быть
            как текстовым, так и содержать сырые байты
        filename: Имя файла
        tags: Теги для файла, используемые при поиске
        return_tags: Возвращать переданные теги при запросе
        type: Тип документа: файл/голосовое сообщение/граффити

    Returns:
        Враппер загруженного документа. Этот объект можно напрямую
        передать в поле `attachments` при отправке сообщения
    """
    return await self.api.upload_doc_to_message(
        content,
        filename,
        tags=tags,
        return_tags=return_tags,
        type=type,
        peer_id=self.truncated_message.peer_id,
    )

upload_video async

upload_video(
    file,
    *,
    name=None,
    description=None,
    is_private=True,
    wallpost=False,
    link=None,
    group_id=None,
    album_id=None,
    privacy_view=None,
    privacy_comment=None,
    no_comments=False,
    repeat=False,
    compression=False
)

Загружает видео для отправки в сообщение

Parameters:

Name Type Description Default
file PhotoEntityTyping

Видео файл в виде ссылки/пути до файла/сырых байтов/IO-хранилища

required
name str | None

Название видео

None
description str | None

Описание видео

None
is_private bool

Является ли видео приватным

True
wallpost bool

Опубликовать видео на стене после сохранения

False
link str | None

URL для встраивания видео с внешнего сайта

None
group_id int | None

ID сообщества (для сообществ)

None
album_id int | None

ID альбома, в который нужно загрузить видео

None
privacy_view list[str] | None

Настройки приватности для просмотра

None
privacy_comment list[str] | None

Настройки приватности для комментирования

None
no_comments bool

Отключить комментарии

False
repeat bool

Зациклить воспроизведение видео

False
compression bool

Сжать видео для мобильных устройств

False

Returns:

Type Description
Video

Враппер загруженного видео. Этот объект можно напрямую

Video

передать в поле attachments при отправке сообщения

Source code in vkflow\models\message.py
async def upload_video(
    self,
    file: PhotoEntityTyping,
    *,
    name: str | None = None,
    description: str | None = None,
    is_private: bool = True,
    wallpost: bool = False,
    link: str | None = None,
    group_id: int | None = None,
    album_id: int | None = None,
    privacy_view: list[str] | None = None,
    privacy_comment: list[str] | None = None,
    no_comments: bool = False,
    repeat: bool = False,
    compression: bool = False,
) -> Video:
    """
    Загружает видео для отправки в сообщение

    Arguments:
        file: Видео файл в виде ссылки/пути до файла/сырых байтов/IO-хранилища
        name: Название видео
        description: Описание видео
        is_private: Является ли видео приватным
        wallpost: Опубликовать видео на стене после сохранения
        link: URL для встраивания видео с внешнего сайта
        group_id: ID сообщества (для сообществ)
        album_id: ID альбома, в который нужно загрузить видео
        privacy_view: Настройки приватности для просмотра
        privacy_comment: Настройки приватности для комментирования
        no_comments: Отключить комментарии
        repeat: Зациклить воспроизведение видео
        compression: Сжать видео для мобильных устройств

    Returns:
        Враппер загруженного видео. Этот объект можно напрямую
        передать в поле `attachments` при отправке сообщения
    """
    return await self.api.upload_video_to_message(
        file,
        name=name,
        description=description,
        is_private=is_private,
        wallpost=wallpost,
        link=link,
        group_id=group_id,
        album_id=album_id,
        privacy_view=privacy_view,
        privacy_comment=privacy_comment,
        no_comments=no_comments,
        repeat=repeat,
        compression=compression,
    )

delete async

delete(
    *,
    spam=None,
    group_id=None,
    delete_for_all=True,
    delay=None
)

Удаляет указанное сообщение (по умолчанию у всех)

:param spam: Пометить сообщение как спам :param group_id: ID группы, от лица которого было отправлено сообщение :param delete_for_all: Нужно ли удалять сообщение у всех :param delay: Задержка перед удалением в секундах. Если None - удаляет сразу. Если указано число, удаляет сообщение через указанное время. При использовании delay удаление выполняется в фоновой задаче.

Example

Удалить сразу

await msg.delete()

Удалить через 5 секунд

await msg.delete(delay=5)

Удалить через 1.5 секунды

await msg.delete(delay=1.5)

Source code in vkflow\models\message.py
async def delete(
    self,
    *,
    spam: bool | None = None,
    group_id: int | None = None,
    delete_for_all: bool = True,
    delay: int | float | None = None,
) -> None:
    """
    Удаляет указанное сообщение (по умолчанию у всех)

    :param spam: Пометить сообщение как спам
    :param group_id: ID группы, от лица которого
        было отправлено сообщение
    :param delete_for_all: Нужно ли удалять сообщение у всех
    :param delay: Задержка перед удалением в секундах.
        Если None - удаляет сразу. Если указано число,
        удаляет сообщение через указанное время.
        При использовании delay удаление выполняется в фоновой задаче.

    Example:
        # Удалить сразу
        await msg.delete()

        # Удалить через 5 секунд
        await msg.delete(delay=5)

        # Удалить через 1.5 секунды
        await msg.delete(delay=1.5)
    """

    async def _delete() -> None:
        if delay is not None:
            await asyncio.sleep(delay)

        try:
            routing = self._get_routing_params("message_ids")

            await self.api.method(
                "messages.delete",
                spam=spam,
                group_id=group_id,
                delete_for_all=delete_for_all,
                **routing,
            )

        except Exception as exc:
            logger.debug("Failed to delete message: {}", exc)

    if delay is not None:
        task = asyncio.create_task(_delete())
        _background_tasks.add(task)
        task.add_done_callback(_background_tasks.discard)

    else:
        routing = self._get_routing_params("message_ids")

        await self.api.method(
            "messages.delete",
            spam=spam,
            group_id=group_id,
            delete_for_all=delete_for_all,
            **routing,
        )

reply async

reply(
    message: str | None = None,
    /,
    *,
    random_id: int | None = None,
    lat: float | None = None,
    long: float | None = None,
    attachment: SingleAttachment,
    sticker_id: int | None = None,
    group_id: int | None = None,
    keyboard: str | Keyboard | None = None,
    template: str | Carousel | None = None,
    payload: str | None = None,
    dont_parse_links: bool | None = None,
    disable_mentions: bool = True,
    intent: str | None = None,
    expire_ttl: int | None = None,
    silent: bool | None = None,
    subscribe_id: int | None = None,
    content_source: str | None = None,
    delete_after: int | float | None = None,
    **kwargs,
) -> SentMessage
reply(
    message: str | None = None,
    /,
    *,
    random_id: int | None = None,
    lat: float | None = None,
    long: float | None = None,
    attachments: AttachmentsList,
    sticker_id: int | None = None,
    group_id: int | None = None,
    keyboard: str | Keyboard | None = None,
    template: str | Carousel | None = None,
    payload: str | None = None,
    dont_parse_links: bool | None = None,
    disable_mentions: bool = True,
    intent: str | None = None,
    expire_ttl: int | None = None,
    silent: bool | None = None,
    subscribe_id: int | None = None,
    content_source: str | None = None,
    delete_after: int | float | None = None,
    **kwargs,
) -> SentMessage
reply(
    message: str | None = None,
    /,
    *,
    random_id: int | None = None,
    lat: float | None = None,
    long: float | None = None,
    attachment: SingleAttachment,
    attachments: AttachmentsList,
    sticker_id: int | None = None,
    group_id: int | None = None,
    keyboard: str | Keyboard | None = None,
    template: str | Carousel | None = None,
    payload: str | None = None,
    dont_parse_links: bool | None = None,
    disable_mentions: bool = True,
    intent: str | None = None,
    expire_ttl: int | None = None,
    silent: bool | None = None,
    subscribe_id: int | None = None,
    content_source: str | None = None,
    delete_after: int | float | None = None,
    **kwargs,
) -> SentMessage
reply(
    message: str | None = None,
    /,
    *,
    random_id: int | None = None,
    lat: float | None = None,
    long: float | None = None,
    sticker_id: int | None = None,
    group_id: int | None = None,
    keyboard: str | Keyboard | None = None,
    template: str | Carousel | None = None,
    payload: str | None = None,
    dont_parse_links: bool | None = None,
    disable_mentions: bool = True,
    intent: str | None = None,
    expire_ttl: int | None = None,
    silent: bool | None = None,
    subscribe_id: int | None = None,
    content_source: str | None = None,
    delete_after: int | float | None = None,
    **kwargs,
) -> SentMessage
reply(
    message=None,
    /,
    *,
    random_id=None,
    lat=None,
    long=None,
    attachment=None,
    attachments=None,
    sticker_id=None,
    group_id=None,
    keyboard=None,
    template=None,
    payload=None,
    dont_parse_links=None,
    disable_mentions=True,
    intent=None,
    expire_ttl=None,
    silent=None,
    subscribe_id=None,
    content_source=None,
    delete_after=None,
    view=None,
    **kwargs,
)

Отвечает на сообщение

:param message: Текст сообщения :param delete_after: Удалить сообщение через указанное количество секунд. Если None - сообщение не удаляется автоматически. :param view: Interactive View with buttons

Example

Ответить и удалить через 5 секунд

await msg.reply("Это сообщение исчезнет!", delete_after=5)

Source code in vkflow\models\message.py
async def reply(
    self,
    message: str | None = None,
    /,
    *,
    random_id: int | None = None,
    lat: float | None = None,
    long: float | None = None,
    attachment: SingleAttachment | None = None,
    attachments: AttachmentsList | None = None,
    sticker_id: int | None = None,
    group_id: int | None = None,
    keyboard: str | Keyboard | None = None,
    template: str | Carousel | None = None,
    payload: str | None = None,
    dont_parse_links: bool | None = None,
    disable_mentions: bool = True,
    intent: str | None = None,
    expire_ttl: int | None = None,
    silent: bool | None = None,
    subscribe_id: int | None = None,
    content_source: str | None = None,
    delete_after: int | float | None = None,
    view: View | None = None,
    **kwargs,
) -> SentMessage:
    """
    Отвечает на сообщение

    :param message: Текст сообщения
    :param delete_after: Удалить сообщение через указанное количество секунд.
        Если None - сообщение не удаляется автоматически.
    :param view: Interactive View with buttons

    Example:
        # Ответить и удалить через 5 секунд
        await msg.reply("Это сообщение исчезнет!", delete_after=5)
    """
    if view is not None:
        keyboard = view.to_keyboard()

    params = dict(
        message=message,
        random_id=random_id_() if random_id is None else random_id,
        lat=lat,
        long=long,
        attachment=attachment,
        attachments=attachments,
        sticker_id=sticker_id,
        group_id=group_id,
        keyboard=keyboard,
        payload=payload,
        dont_parse_links=dont_parse_links,
        disable_mentions=disable_mentions,
        intent=intent,
        expire_ttl=expire_ttl,
        silent=silent,
        subscribe_id=subscribe_id,
        content_source=content_source,
        template=template,
        peer_ids=self.truncated_message.peer_id,
        **kwargs,
    )

    match self.truncated_message.id:
        case msg_id if msg_id:
            params["reply_to"] = msg_id
        case _:
            params["forward"] = {
                "is_reply": True,
                "conversation_message_ids": [self.truncated_message.conversation_message_id],
                "peer_id": self.truncated_message.peer_id,
            }

    sent_message = await self._send_message(params)

    if view is not None:
        view.message = sent_message

        if hasattr(self, "bot") and hasattr(self.bot, "app") and hasattr(self.bot.app, "view_store"):
            self.bot.app.view_store.add(view)

    if delete_after is not None:
        await sent_message.delete(delay=delete_after)

    return sent_message

answer async

answer(
    message: str | None = None,
    *,
    random_id: int | None = None,
    lat: float | None = None,
    long: float | None = None,
    attachment: SingleAttachment,
    sticker_id: int | None = None,
    group_id: int | None = None,
    keyboard: str | Keyboard | None = None,
    payload: str | None = None,
    dont_parse_links: bool | None = None,
    disable_mentions: bool = True,
    template: str | Carousel | None = None,
    intent: str | None = None,
    expire_ttl: int | None = None,
    silent: bool | None = None,
    subscribe_id: int | None = None,
    content_source: str | None = None,
    delete_after: int | float | None = None,
    **kwargs
) -> SentMessage
answer(
    message: str | None = None,
    *,
    random_id: int | None = None,
    lat: float | None = None,
    long: float | None = None,
    attachments: AttachmentsList,
    sticker_id: int | None = None,
    group_id: int | None = None,
    keyboard: str | Keyboard | None = None,
    payload: str | None = None,
    dont_parse_links: bool | None = None,
    disable_mentions: bool = True,
    template: str | Carousel | None = None,
    intent: str | None = None,
    expire_ttl: int | None = None,
    silent: bool | None = None,
    subscribe_id: int | None = None,
    content_source: str | None = None,
    delete_after: int | float | None = None,
    **kwargs
) -> SentMessage
answer(
    message: str | None = None,
    *,
    random_id: int | None = None,
    lat: float | None = None,
    long: float | None = None,
    attachment: SingleAttachment,
    attachments: AttachmentsList,
    sticker_id: int | None = None,
    group_id: int | None = None,
    keyboard: str | Keyboard | None = None,
    payload: str | None = None,
    dont_parse_links: bool | None = None,
    disable_mentions: bool = True,
    template: str | Carousel | None = None,
    intent: str | None = None,
    expire_ttl: int | None = None,
    silent: bool | None = None,
    subscribe_id: int | None = None,
    content_source: str | None = None,
    delete_after: int | float | None = None,
    **kwargs
) -> SentMessage
answer(
    message: str | None = None,
    *,
    random_id: int | None = None,
    lat: float | None = None,
    long: float | None = None,
    sticker_id: int | None = None,
    group_id: int | None = None,
    keyboard: str | Keyboard | None = None,
    payload: str | None = None,
    dont_parse_links: bool | None = None,
    disable_mentions: bool = True,
    template: str | Carousel | None = None,
    intent: str | None = None,
    expire_ttl: int | None = None,
    silent: bool | None = None,
    subscribe_id: int | None = None,
    content_source: str | None = None,
    delete_after: int | float | None = None,
    **kwargs
) -> SentMessage
answer(
    message=None,
    *,
    random_id=None,
    lat=None,
    long=None,
    attachment=None,
    attachments=None,
    sticker_id=None,
    group_id=None,
    keyboard=None,
    payload=None,
    dont_parse_links=None,
    disable_mentions=True,
    template=None,
    intent=None,
    expire_ttl=None,
    silent=None,
    subscribe_id=None,
    content_source=None,
    view=None,
    delete_after=None,
    **kwargs
)

Отправляет сообщение в тот же чат

:param message: Текст сообщения :param delete_after: Удалить сообщение через указанное количество секунд. Если None - сообщение не удаляется автоматически.

Example

Отправить сообщение и удалить через 5 секунд

await msg.answer("Это сообщение исчезнет!", delete_after=5)

Source code in vkflow\models\message.py
async def answer(
    self,
    message: str | None = None,
    *,
    random_id: int | None = None,
    lat: float | None = None,
    long: float | None = None,
    attachment: SingleAttachment | None = None,
    attachments: AttachmentsList | None = None,
    sticker_id: int | None = None,
    group_id: int | None = None,
    keyboard: str | Keyboard | None = None,
    payload: str | None = None,
    dont_parse_links: bool | None = None,
    disable_mentions: bool = True,
    template: str | Carousel | None = None,
    intent: str | None = None,
    expire_ttl: int | None = None,
    silent: bool | None = None,
    subscribe_id: int | None = None,
    content_source: str | None = None,
    view: View | None = None,
    delete_after: int | float | None = None,
    **kwargs,
) -> SentMessage:
    """
    Отправляет сообщение в тот же чат

    :param message: Текст сообщения
    :param delete_after: Удалить сообщение через указанное количество секунд.
        Если None - сообщение не удаляется автоматически.

    Example:
        # Отправить сообщение и удалить через 5 секунд
        await msg.answer("Это сообщение исчезнет!", delete_after=5)
    """
    if view is not None:
        keyboard = view.to_keyboard()

    params = dict(
        message=message,
        random_id=random_id_() if random_id is None else random_id,
        lat=lat,
        long=long,
        attachment=attachment,
        attachments=attachments,
        sticker_id=sticker_id,
        group_id=group_id,
        keyboard=keyboard,
        payload=payload,
        dont_parse_links=dont_parse_links,
        disable_mentions=disable_mentions,
        intent=intent,
        expire_ttl=expire_ttl,
        silent=silent,
        subscribe_id=subscribe_id,
        content_source=content_source,
        template=template,
        peer_ids=self.truncated_message.peer_id,
        **kwargs,
    )

    sent_message = await self._send_message(params)

    if view is not None:
        view.message = sent_message

        if hasattr(self, "bot") and hasattr(self.bot, "app") and hasattr(self.bot.app, "view_store"):
            self.bot.app.view_store.add(view)

    if delete_after is not None:
        await sent_message.delete(delay=delete_after)

    return sent_message

forward async

forward(
    message: str | None = None,
    *,
    random_id: int | None = None,
    lat: float | None = None,
    long: float | None = None,
    attachment: SingleAttachment,
    sticker_id: int | None = None,
    group_id: int | None = None,
    keyboard: str | Keyboard | None = None,
    payload: str | None = None,
    dont_parse_links: bool | None = None,
    disable_mentions: bool = True,
    intent: str | None = None,
    expire_ttl: int | None = None,
    silent: bool | None = None,
    subscribe_id: int | None = None,
    template: str | Carousel | None = None,
    content_source: str | None = None,
    delete_after: int | float | None = None,
    **kwargs
) -> SentMessage
forward(
    message: str | None = None,
    *,
    random_id: int | None = None,
    lat: float | None = None,
    long: float | None = None,
    attachments: AttachmentsList,
    sticker_id: int | None = None,
    group_id: int | None = None,
    keyboard: str | Keyboard | None = None,
    payload: str | None = None,
    dont_parse_links: bool | None = None,
    disable_mentions: bool = True,
    intent: str | None = None,
    expire_ttl: int | None = None,
    silent: bool | None = None,
    subscribe_id: int | None = None,
    template: str | Carousel | None = None,
    content_source: str | None = None,
    delete_after: int | float | None = None,
    **kwargs
) -> SentMessage
forward(
    message: str | None = None,
    *,
    random_id: int | None = None,
    lat: float | None = None,
    long: float | None = None,
    attachment: SingleAttachment,
    attachments: AttachmentsList,
    sticker_id: int | None = None,
    group_id: int | None = None,
    keyboard: str | Keyboard | None = None,
    payload: str | None = None,
    dont_parse_links: bool | None = None,
    disable_mentions: bool = True,
    intent: str | None = None,
    expire_ttl: int | None = None,
    silent: bool | None = None,
    subscribe_id: int | None = None,
    template: str | Carousel | None = None,
    content_source: str | None = None,
    delete_after: int | float | None = None,
    **kwargs
) -> SentMessage
forward(
    message: str | None = None,
    *,
    random_id: int | None = None,
    lat: float | None = None,
    long: float | None = None,
    sticker_id: int | None = None,
    group_id: int | None = None,
    keyboard: str | Keyboard | None = None,
    payload: str | None = None,
    dont_parse_links: bool | None = None,
    disable_mentions: bool = True,
    intent: str | None = None,
    expire_ttl: int | None = None,
    silent: bool | None = None,
    subscribe_id: int | None = None,
    template: str | Carousel | None = None,
    content_source: str | None = None,
    delete_after: int | float | None = None,
    **kwargs
) -> SentMessage
forward(
    message=None,
    *,
    random_id=None,
    lat=None,
    long=None,
    attachment=None,
    attachments=None,
    sticker_id=None,
    group_id=None,
    keyboard=None,
    payload=None,
    dont_parse_links=None,
    disable_mentions=True,
    intent=None,
    expire_ttl=None,
    silent=None,
    subscribe_id=None,
    template=None,
    content_source=None,
    delete_after=None,
    view=None,
    **kwargs
)

Пересылает сообщение

:param message: Текст сообщения :param delete_after: Удалить сообщение через указанное количество секунд. Если None - сообщение не удаляется автоматически. :param view: Interactive View with buttons

Example

Переслать и удалить через 5 секунд

await msg.forward("Пересланное сообщение", delete_after=5)

Source code in vkflow\models\message.py
async def forward(
    self,
    message: str | None = None,
    *,
    random_id: int | None = None,
    lat: float | None = None,
    long: float | None = None,
    attachment: SingleAttachment | None = None,
    attachments: AttachmentsList | None = None,
    sticker_id: int | None = None,
    group_id: int | None = None,
    keyboard: str | Keyboard | None = None,
    payload: str | None = None,
    dont_parse_links: bool | None = None,
    disable_mentions: bool = True,
    intent: str | None = None,
    expire_ttl: int | None = None,
    silent: bool | None = None,
    subscribe_id: int | None = None,
    template: str | Carousel | None = None,
    content_source: str | None = None,
    delete_after: int | float | None = None,
    view: View | None = None,
    **kwargs,
) -> SentMessage:
    """
    Пересылает сообщение

    :param message: Текст сообщения
    :param delete_after: Удалить сообщение через указанное количество секунд.
        Если None - сообщение не удаляется автоматически.
    :param view: Interactive View with buttons

    Example:
        # Переслать и удалить через 5 секунд
        await msg.forward("Пересланное сообщение", delete_after=5)
    """
    if view is not None:
        keyboard = view.to_keyboard()

    params = dict(
        message=message,
        random_id=random_id_() if random_id is None else random_id,
        lat=lat,
        long=long,
        attachment=attachment,
        attachments=attachments,
        sticker_id=sticker_id,
        group_id=group_id,
        keyboard=keyboard,
        payload=payload,
        dont_parse_links=dont_parse_links,
        disable_mentions=disable_mentions,
        intent=intent,
        expire_ttl=expire_ttl,
        silent=silent,
        subscribe_id=subscribe_id,
        content_source=content_source,
        template=template,
        peer_ids=self.truncated_message.peer_id,
        **kwargs,
    )

    match self.truncated_message.id:
        case msg_id if msg_id:
            params["forward_messages"] = msg_id
        case _:
            params["forward"] = {
                "conversation_message_ids": [self.truncated_message.conversation_message_id],
                "peer_id": self.truncated_message.peer_id,
            }

    sent_message = await self._send_message(params)

    if view is not None:
        view.message = sent_message

        if hasattr(self, "bot") and hasattr(self.bot, "app") and hasattr(self.bot.app, "view_store"):
            self.bot.app.view_store.add(view)

    if delete_after is not None:
        await sent_message.delete(delay=delete_after)

    return sent_message

Attachment

Attachment

Attachment(fields)

Bases: Wrapper, APISerializableMixin

Source code in vkflow\base\wrapper.py
def __init__(self, fields: dict) -> None:
    self._fields = fields

Photo

Photo

Photo(fields)

Bases: Attachment

Source code in vkflow\base\wrapper.py
def __init__(self, fields: dict) -> None:
    self._fields = fields

Video

Video

Video(fields)

Bases: Attachment

Source code in vkflow\base\wrapper.py
def __init__(self, fields: dict) -> None:
    self._fields = fields

Audio

Audio

Audio(fields)

Bases: Attachment

Source code in vkflow\base\wrapper.py
def __init__(self, fields: dict) -> None:
    self._fields = fields

Document

Document

Document(fields)

Bases: Attachment

Source code in vkflow\base\wrapper.py
def __init__(self, fields: dict) -> None:
    self._fields = fields