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.2.0.tar.gz (174.5 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.2.0-py3-none-any.whl (218.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for vkflow-1.2.0.tar.gz
Algorithm Hash digest
SHA256 66acef0fdf4d7105c882db251e1624bcf18373cf7d86c066e4f4d60ebd16577d
MD5 5613a973ed81493274c271a9bb2f23ae
BLAKE2b-256 292b82289821b82597f8c38d16f0382c135e770bfb74dbb52246420fcdc2f362

See more details on using hashes here.

Provenance

The following attestation bundles were made for vkflow-1.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: vkflow-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 218.4 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 afe67a315c1a279248f1097e978883edee03aafd50bdd3d8b230b79823e958a8
MD5 74bedfb2d544c38fc519467f9d72c55f
BLAKE2b-256 4b0f855d6027001f52f843f9c074df92afbbaa0290948bb31d1c2b5ddfcf8fea

See more details on using hashes here.

Provenance

The following attestation bundles were made for vkflow-1.2.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