From ab9302bc30e1a21a3c22735a9d7777bf6b3ec90e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro?= Date: Mon, 18 Mar 2024 14:13:24 -0300 Subject: [PATCH] update docs style --- docs/index.md | 73 ++++++++++++++++++++++++++++++++++++++++++--------- mkdocs.yml | 4 +++ 2 files changed, 65 insertions(+), 12 deletions(-) diff --git a/docs/index.md b/docs/index.md index 000ea34..c2f069c 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,17 +1,66 @@ -# Welcome to MkDocs +# Welcome to Botgen -For full documentation visit [mkdocs.org](https://www.mkdocs.org). +- [Documentation](https://jpfcabral.github.io/botgen/) +- [Source code](https://github.com/jpfcabral/botgen) -## Commands +*Python-based open source developer tool for building chat bots, apps and custom integrations for major messaging platforms.* -* `mkdocs new [dir-name]` - Create a new project. -* `mkdocs serve` - Start the live-reloading docs server. -* `mkdocs build` - Build the documentation site. -* `mkdocs -h` - Print help message and exit. +This repository is inspired by the javascript library [Botkit](https://github.com/howdyai/botgen) and the [BotFramework SDK](https://github.com/microsoft/botframework-sdk) concepts. -## Project layout +### Adapters - mkdocs.yml # The configuration file. - docs/ - index.md # The documentation homepage. - ... # Other markdown pages, images and other files. +You can connect major plataforms using the same bot core code by setting different adapters. Adapter is a interface between your bot and message plataforms. + + +| Adapter | Docs | Availability | +|---------| -----|--------------| +| Web | | 0.0.1 | +| Telegram | | | +| Discord | | | +| Slack | | | +| Facebook | | | +| Twilio (SMS) | | | +| Whatsapp | | | + +### Usage + +Installation + +`pip install botgen` + +Copy and paste the code below to a file called `run.py` + +```python +# run.py +from botgen import Bot +from botgen import BotMessage +from botgen import BotWorker +from botgen.adapters import WebAdapter + +adapter = WebAdapter() +bot = Bot(adapter=adapter) + +async def hello(bot_worker: BotWorker, message: BotMessage): + await bot_worker.say("hello from bot") + + +bot.hears(pattern="hello", event="message", handler=hello) + +bot.start() +``` + +So you can run the project using: + +`python run.py` + +Then start a conversation: + +```bash +curl -L -X POST 'http://localhost:8080/api/messages' -H 'Content-Type: application/json' -d '{ + "user": "dummy", + "text": "hello", + "type": "message" +}' +``` + +### How to contribute diff --git a/mkdocs.yml b/mkdocs.yml index 058dc26..80aeddd 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -3,3 +3,7 @@ site_name: Botgen nav: - Home: index.md - Introduction: intro.md + - Conversation: conversation.md + +theme: + name: material