Skip to content

Методы

Типизированные обёртки VK API методов. Все находятся в fastvk.methods и регистрируются в глобальном _REGISTRY.

messages

messages.send

await bot.messages.send(
    peer_id: int,
    message: str,
    *,
    random_id: int = 0,
    keyboard: str | None = None,
    attachment: str | None = None,
    reply_to: int | None = None,
    dont_parse_links: bool = False,
    disable_mentions: bool = False,
) -> int   # ID сообщения

messages.edit

await bot.messages.edit(
    peer_id: int,
    message_id: int,
    message: str,
    *,
    keyboard: str | None = None,
    attachment: str | None = None,
) -> int

messages.delete

await bot.messages.delete(
    message_ids: int | list[int],
    *,
    peer_id: int | None = None,
    delete_for_all: bool = False,
) -> int

messages.pin

await bot.messages.pin(peer_id: int, message_id: int) -> dict

messages.unpin

await bot.messages.unpin(peer_id: int) -> int

messages.mark_as_read

await bot.messages.mark_as_read(peer_id: int) -> int

messages.get_history

await bot.messages.get_history(
    peer_id: int,
    *,
    count: int = 20,
    offset: int = 0,
) -> dict   # {"count": int, "items": list[dict]}

messages.set_activity

await bot.messages.set_activity(
    peer_id: int,
    type: str = "typing",
) -> int

messages.send_event_answer

await bot.messages.send_event_answer(
    event_id: str,
    user_id: int,
    peer_id: int,
    *,
    event_data: str | None = None,
) -> int

users

users.get

await bot.users.get(
    user_ids: int | str | list,
    *,
    fields: str = "",
) -> list[dict]

groups

groups.get_by_id

await bot.groups.get_by_id(
    *,
    fields: str = "",
) -> list[dict]

wall

wall.post

await bot.wall.post(
    owner_id: int,
    message: str,
    *,
    attachments: str | None = None,
) -> dict   # {"post_id": int}

wall.get_by_id

await bot.wall.get_by_id(posts: str) -> list[dict]

Формат posts: "{owner_id}_{post_id}" или список через запятую.

photos

photos.get_messages_upload_server

await bot.photos.get_messages_upload_server(peer_id: int) -> dict
# {"upload_url": str, "album_id": int, "user_id": int}

photos.save_messages_photo

await bot.photos.save_messages_photo(
    photo: str,
    server: int,
    hash: str,
) -> list[dict]

docs

docs.get_messages_upload_server

await bot.docs.get_messages_upload_server(
    peer_id: int,
    *,
    type: str = "doc",
) -> dict   # {"upload_url": str}

docs.save

await bot.docs.save(
    file: str,
    *,
    title: str = "",
    tags: str = "",
) -> dict