Skip to main content

Working with VK by this homogenetic way and it's awesome!

Project description

VKBottle - high quality VK Tool

downloads service-test status

VKBottle - это многофункциональный модуль для работы с VK Api и создания ботов


Установка

  1. С помощью установщика pip из PyPi:

    pip install vkbottle
    
  2. С помощью установщика pip из GitHub:

    pip install https://github.com/timoniq/vkbottle/archive/master.zip --upgrade
    

Фишки

  • Удобная и быстрая доставка сообщений через regex
  • Быстрый API враппер
  • Быстрый LongPoll фреймворк для ботов
  • Маленький объем кода для достижения сложных конструкций
  • Полностью асинхронно
  • Множество встроенных помощников: Branches для цепей событий, VBML для разметки сообщений и так далее
  • Правила - Rules

Longpoll

from vkbottle import Bot, Message

bot = Bot('my-token', 123, debug=True)


@bot.on.message(text='My name is <name>', lower=True)
async def wrapper(ans: Message, name):
    await ans('Hello, {}'.format(name))


bot.run_polling()

Callback

from vkbottle import Bot, Message
from aiohttp.web import RouteTableDef, Application, Request, run_app


app = Application()
routes = RouteTableDef()
bot = Bot('my-token', 123, debug=True, secret="SecretKey")

@routes.get('/bot')
async def executor(request: Request):
    return await bot.emulate(event=dict(request.query), confirmation_token="ConfirmationToken")

@bot.on.message(text='test', lower=True)
async def wrapper():
    return "test"

app.add_routes(routes)
run_app(app)

Rules

from vkbottle import Bot, Message
from vkbottle.rule import AttachmentRule

bot = Bot("my-token", 123, debug=True)

@bot.on.message(AttachmentRule("photo"))
async def wrapper():
    return "What a beautiful photo!"
    
bot.run_polling()

Больше примеров в папке /examples

Документация

Полная документация:

Contributing

ПР поддерживаются! Мне приятно видеть ваш вклад в развитие библиотеки
Задавайте вопросы в блоке Issues и в чате VK!

Лицензия

Copyright © 2019-2020 timoniq.
Этот проект имеет GPL-3.0 лицензию.

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

vkbottle-1.0.0.tar.gz (36.9 kB view hashes)

Uploaded Source

Supported by

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