-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
65 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters