{"id":13400844,"url":"https://github.com/SavinMike/alice-kotlin-bot","last_synced_at":"2025-03-14T06:31:58.648Z","repository":{"id":152035933,"uuid":"137667254","full_name":"SavinMike/alice-kotlin-bot","owner":"SavinMike","description":"Kotlin library for creating Alice's skills (Wrapper for the Yandex.Dialog API)","archived":false,"fork":false,"pushed_at":"2019-12-06T10:02:57.000Z","size":24,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-07-31T19:26:32.076Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SavinMike.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-06-17T15:55:29.000Z","updated_at":"2023-10-06T21:25:33.000Z","dependencies_parsed_at":"2023-09-14T04:02:57.564Z","dependency_job_id":null,"html_url":"https://github.com/SavinMike/alice-kotlin-bot","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SavinMike%2Falice-kotlin-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SavinMike%2Falice-kotlin-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SavinMike%2Falice-kotlin-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SavinMike%2Falice-kotlin-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SavinMike","download_url":"https://codeload.github.com/SavinMike/alice-kotlin-bot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243537947,"owners_count":20307098,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T19:00:56.120Z","updated_at":"2025-03-14T06:31:58.634Z","avatar_url":"https://github.com/SavinMike.png","language":"Kotlin","funding_links":[],"categories":["Разработка"],"sub_categories":["SDK"],"readme":"[![](https://jitpack.io/v/SavinMike/alicebot.svg)](https://jitpack.io/#SavinMike/alice-kotlin-bot)\n# alice-kotlin-bot\nThis is library for work with [Alice Yandex.Dialog API](https://tech.yandex.ru/dialogs/alice/). Check the simple implemetation of the [\"Buy the Elephant\" Game](./sample/src/main/kotlin/com/github/savinmike/alice/sample/BuyElephant.kt)\n# Usage\nThe *alice-kotlin-bot* is using [ktor](https://ktor.io/) library under the hood. By default it is looking at *0.0.0.0* host with port *8080*. For start working with *alice-kotlin-bot* you should add [needed engine](https://ktor.io/quickstart/quickstart/gradle.html#engine) to your project dependency and set up *webhook* url:\n```\nalice {\n    webhook = \"alice-webhook\"\n    applicationEngineFactory = Netty\n    ...\n}\n```\nAll events will dispatch by [Dispatcher](alice/src/main/kotlin/com/github/savinmike/alice/model/event/DialogDispatcher.kt). Now it allow you to handle **text messages** and **button click**. Also it provides event when user start discussion by `welcome` *handler*:\n```\nalice {\n    webhook = \"alice-webhook\"\n    applicationEngineFactory = Netty\n    dispatch {\n        welcome {\n            \"Привет давай поиграем в игру \\\"Купи Слона\\\"\".wrapToResponseData()\n        }\n        onClick(title = END_SESSION_BUTTON_TEXT) {\n            ResponseData(text = \"Ну чтож, так и быть. Приходи в следующий раз.\", endSession = true)\n        }\n        default {\n            ResponseData(text = \"Все говорят \\\"${it.request.originalUtterance}\\\", а ты купи слона\",\n                buttons = listOf(Button(title = END_SESSION_BUTTON_TEXT)))\n            }\n        }\n}\n```\nIf there is no *handler* which can handle event, `default` *handler* will be called.\n\nEach *handler* must return [ResponseData](alice/com/github/savinmike/alice/model/data/Response.kt). You can simply wrap text or buttons to the `ResponseData` by using [wrappers](alice/com/github/savinmike/alice/model/mapper/ResponseDataWrapper.kt)\n\nFor debugging without deploy you can use library which will retranslate your localhost to public server. For example [ngrok](https://ngrok.com)\n\n# Implementation\n* Add the JitPack repository to your **root** build.gradle file:\n```\nrepositories {\n    maven { url \"https://jitpack.io\" }\n}\n```\n* Add the code to your **module's** build.gradle file:\n```\ndependencies {\n    implementation 'com.github.SavinMike:alice-kotlin-bot:0.1.1'\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSavinMike%2Falice-kotlin-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSavinMike%2Falice-kotlin-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSavinMike%2Falice-kotlin-bot/lists"}