Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aliceio

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aliceio

Asynchronous framework for Alice from Yandex Dialogs

  • 0.2.0
  • PyPI
  • Socket score

Maintainers
1

aliceio

AliceIO

License Status PyPI Downloads GitHub Repo stars Supported python versions Tests Coverage

Асинхронный фреймворк для разработки навыков Алисы из Яндекс.Диалогов

Based on aiogram v3

Особенности

Важно!

Рекомендуется иметь опыт работы с asyncio перед использованием aliceio

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

Как получить skill_id и подключить навык к Алисе можно прочитать тут.

Yandex Cloud Functions:

from aliceio import Dispatcher, Skill
from aliceio.types import Message
from aliceio.webhook.yandex_functions import OneSkillYandexFunctionsRequestHandler

dp = Dispatcher()
skill = Skill(skill_id="...")
requests_handler = OneSkillYandexFunctionsRequestHandler(dispatcher=dp, skill=skill)

@dp.message()
async def hello(message: Message) -> str:
    return f"Привет, {message.session.application.application_id}!"

async def main(event, context):
    return await requests_handler(event, context)

Вебхук:

from aiohttp import web
from aliceio import Dispatcher, Skill
from aliceio.types import Message
from aliceio.webhook.aiohttp_server import OneSkillAiohttpRequestHandler, setup_application

dp = Dispatcher()
skill = Skill(skill_id="...")

@dp.message()
async def hello(message: Message) -> str:
    return f"Привет, {message.session.application.application_id}!"

def main() -> None:
    app = web.Application()
    requests_handler = OneSkillAiohttpRequestHandler(dispatcher=dp, skill=skill)

    WEB_SERVER_HOST = "127.0.0.1"
    WEB_SERVER_PORT = 80
    WEBHOOK_PATH = "/alice"

    requests_handler.register(app, path=WEBHOOK_PATH)
    setup_application(app, dp, skill=skill)
    web.run_app(app, host=WEB_SERVER_HOST, port=WEB_SERVER_PORT)

if __name__ == "__main__":
    main()

Материалы

Связь

Если у вас есть вопросы, вы можете задать их в Телеграм чате

Лицензия

Copyright © 2023-2024 K1rL3s and ZloyKobra
Этот проект использует MIT лицензию

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc