Skip to main content

solobot-vkteams

Асинхронный Python-фреймворк для создания ботов VK Teams (Mail.ru / ICQ), вдохновлённый aiogram.

Возможности

  • API в стиле aiogram — Bot → Dispatcher → Router → Handlers
  • Фильтры — Command, Regexp, ChatTypeFilter, CallbackData, HasFile, HasImage, IsReply, IsForward и другие
  • Magic Filter — цепочки атрибутов вида F.text.startswith("привет")
  • FSM — конечный автомат с State / StatesGroup и подключаемым хранилищем (MemoryStorage)
  • Треды (Threads) — создание и работа с обсуждениями в чатах
  • Middleware — внешние и внутренние middleware для каждого роутера
  • Inline-клавиатуры — удобный API для построения кнопок
  • Полностью асинхронный — построен на aiohttp
  • Типизированный — включает py.typed, совместим с mypy / pyright

Установка

pip install solobot-vkteams

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

import asyncio
from solobot_vkteams import Bot, Dispatcher, Router, Message, Command, F

TOKEN = "YOUR_TOKEN_HERE"
API_URL = "https://myteam.mail.ru/bot/v1"

bot = Bot(token=TOKEN, api_url_base=API_URL)
dp = Dispatcher()
router = Router()


@router.message(Command("start"))
async def on_start(event: Message, bot: Bot):
    await event.answer("Привет!")


@router.message(F.text)
async def on_text(event: Message, bot: Bot):
    await event.reply(f"Вы написали: {event.text}")


dp.include_router(router)
asyncio.run(dp.run_polling(bot))

Inline-клавиатуры

from solobot_vkteams import InlineKeyboardMarkup, InlineKeyboardButton

kb = InlineKeyboardMarkup()
kb.row(
    InlineKeyboardButton(text="Да", callback_data="yes"),
    InlineKeyboardButton(text="Нет", callback_data="no"),
)

await bot.send_text(chat_id=chat_id, text="Выберите:", inline_keyboard_markup=kb)

FSM (конечный автомат)

from solobot_vkteams import State, StatesGroup, FSMContext

class Form(StatesGroup):
    name = State()
    age = State()

@router.message(Command("form"))
async def start_form(event: Message, bot: Bot, state: FSMContext):
    await state.set_state(Form.name)
    await event.answer("Как вас зовут?")

@router.message(Form.name)
async def process_name(event: Message, bot: Bot, state: FSMContext):
    await state.update_data(name=event.text)
    await state.set_state(Form.age)
    await event.answer("Сколько вам лет?")

Треды (Threads)

from solobot_vkteams import Thread

# Создание треда
@router.message(Command("createthread"))
async def cmd_create_thread(event: Message, bot: Bot):
    thread = await event.add_thread()
    await thread.send_text("👋 Обсуждение начато!")

# Отправка сообщения в тред
await bot.send_text(
    chat_id=thread_id,
    text="Сообщение в треде"
)

Требования

  • Python 3.12+
  • aiohttp >= 3.9

Лицензия

MIT

Metadata

Release files for solobot-vkteams 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for solobot-vkteams 0.2.1
File Size Uploaded Provenance Actions
solobot_vkteams-0.2.1.tar.gz 19.7 kB Without provenance Details for solobot_vkteams-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for solobot-vkteams 0.2.1
File Interpreter ABI Platform Actions
solobot_vkteams-0.2.1-py3-none-any.whl Python 3 none any Details for solobot_vkteams-0.2.1-py3-none-any.whl

Total release size: 41.6 kB

Release files / solobot_vkteams-0.2.1.tar.gz

Download URL solobot_vkteams-0.2.1.tar.gz
Size 19.7 kB
Tags Source
SHA-256 checksum
How to use checksums
57beb28605909f4fb904b116ee57bbc4721475cae3875ab242c23f20890eeffe
BLAKE2b-256 checksum
How to use checksums
2346497672aa13b5ab8a4a7bc270af020efd170f8edb7bbd500c8ffbcbfa9cd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / solobot_vkteams-0.2.1-py3-none-any.whl

Download URL solobot_vkteams-0.2.1-py3-none-any.whl
Size 21.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e05c0d65233ba221681bb4d4402d5c488de928c640cd57ab3a2f7654393029a
BLAKE2b-256 checksum
How to use checksums
a5e0402819f659a58bd5e9a0cccdc83370d2fceaa2e15b2c5ef386088ca5ae4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for solobot-vkteams 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page