Skip to main content

Modern async VK bot framework

Project description

VKFlow

VKFlow

Современный асинхронный фреймворк для создания ботов ВКонтакте

PyPI Python License Docs VK


Установка

pip install vkflow

С дополнениями для производительности:

pip install vkflow[speed]

Быстрый старт

import vkflow as vf

app = vf.App()

@app.command("ping")
async def ping():
    return "Pong!"

@app.command("дата")
async def reg_date(user: vf.User):
    date = await vf.get_user_registration_date(user.id)
    return f"{user:@[first_name]} зарегистрирован {date:%d.%m.%Y}"

app.run("YOUR_TOKEN")

Возможности

Type hints как аргументы - параметры команд парсятся из аннотаций типов

Интерактивный UI - клавиатуры, карусели, View с callback-кнопками

FSM - конечные автоматы для многошаговых диалогов

Cog-система - группировка команд в модули

Проверки и cooldown - декораторы для контроля доступа

Webhook и LongPoll - оба режима из коробки

Система аддонов - расширение функциональности через плагины

Интерактивные View
class ConfirmView(vf.ui.View):
    def __init__(self):
        super().__init__(timeout = 60, inline = True)
        self.result = None

    @vf.ui.button(label = "Да", color = "positive")
    async def yes(self, interaction: vf.Callback):
        self.result = True
        await interaction.answer("Принято!")
        self.stop()

    @vf.ui.button(label = "Нет", color = "negative")
    async def no(self, interaction: vf.Callback):
        self.result = False
        await interaction.answer("Отменено")
        self.stop()
Cog-модули
class Admin(vf.Cog):
    @vf.command("бан")
    @vf.check(...)
    async def ban(self, ctx: vf.Context, user: vf.User):
        ...
        await ctx.reply(f"{user:@[first_name]} забанен")

Требования

  • Python 3.11+
  • VK API 5.199

Credits

Based on vkquick.

Лицензия

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vkflow-1.1.0.tar.gz (164.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vkflow-1.1.0-py3-none-any.whl (204.9 kB view details)

Uploaded Python 3

File details

Details for the file vkflow-1.1.0.tar.gz.

File metadata

  • Download URL: vkflow-1.1.0.tar.gz
  • Upload date:
  • Size: 164.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vkflow-1.1.0.tar.gz
Algorithm Hash digest
SHA256 8e785355a7115c3ef8ee1a76cbe5bf1e10a0ae0d7dd340776a085309c80b7c4f
MD5 00875f1e9005a98d79bc589215e558c5
BLAKE2b-256 5f566a1af3466d110f7e70917800dd4227bf116f9e02d39be2a3354f57f01335

See more details on using hashes here.

Provenance

The following attestation bundles were made for vkflow-1.1.0.tar.gz:

Publisher: publish.yml on rogue-meow/vkflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vkflow-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: vkflow-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 204.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vkflow-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ff682bd009999cdba9df70554cf40f73a64185cf14282a8315c1256dfb034b4c
MD5 f429c7b1852c08cc67a42e4c073bd507
BLAKE2b-256 ef2d5c1b8420b6d41c87db83c342f1c19f7470aa49cf13c306e75af11e890c9e

See more details on using hashes here.

Provenance

The following attestation bundles were made for vkflow-1.1.0-py3-none-any.whl:

Publisher: publish.yml on rogue-meow/vkflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page