bluebubbles-bot/README.md

75 lines
2.6 KiB
Markdown
Raw Normal View History

2023-04-08 04:48:34 +00:00
# bluebubbles_bot
2023-04-10 21:01:07 +00:00
2023-04-08 04:48:34 +00:00
## A chatbot for a local BlueBlubbles server.
2023-04-08 04:30:59 +00:00
2023-12-06 20:18:15 +00:00
![Build Status](https://jenkins.cronocide.net/buildStatus/icon?job=git.cronocide.net%2Fbluebubbles-bot%2Fmaster)
2023-04-10 21:01:07 +00:00
2023-04-08 04:48:34 +00:00
## Usage
2023-04-08 04:30:59 +00:00
2023-04-08 04:48:34 +00:00
```
2023-04-10 21:14:28 +00:00
usage: bluebubbles_bot [-h] [-l LOG] [-v]
optional arguments:
-h, --help show this help message and exit
-l LOG, --log LOG Specify a file to log to.
-v, --verbose Include verbose information in the output. Add 'v's for more output.
2023-04-08 04:30:59 +00:00
2023-04-10 21:14:28 +00:00
Example:
bluebubbles_bot -h
2023-04-08 04:48:34 +00:00
```
2023-04-11 16:01:07 +00:00
bluebubbles_bot loads instances of the `PersonaSkill` class from python files in the [skills](persona/skills) folder.
2023-04-10 21:14:28 +00:00
You may configure the skill by specifying `startup` and `shutdown` functions to configure your skills as required.
2023-04-11 16:01:07 +00:00
It will be helpful to follow the examples in the [skills](persona/skills) folder for designing your skills for the bot.
2023-04-10 21:14:28 +00:00
2023-04-08 04:48:34 +00:00
## Installation
2023-04-11 05:55:23 +00:00
As with most of my software, this can be installed as a python package or a Docker container.
- `pip3 install bluebubbles_bot`
- `docker build -t blue_bubbles_bot .`
2023-04-08 04:48:34 +00:00
## Configuration
2023-04-10 21:14:28 +00:00
The following environment variables must be set to configure the bot:
2023-04-11 05:51:34 +00:00
`BB_SERVER_URL` : The URL of the BlueBubbles server, including protocol and port.
2023-04-08 04:48:34 +00:00
2023-04-11 05:51:34 +00:00
`BB_SERVER_PASSWORD` : The password to the BlueBubbles server.
2023-04-08 04:48:34 +00:00
2023-04-11 06:25:43 +00:00
`BIND_PORT` : The port to bind to to receive callbacks from the BlueBubbles server.
2023-04-11 05:51:34 +00:00
`USE_PRIVATE_API` : Whether or not to use the Private API in BlueBubbles. Default is `false`
2023-04-08 04:30:59 +00:00
2023-04-18 04:46:50 +00:00
## Configuring Skills
Each skill consumes it's own environment variables to configure and run. Here are some of the configurable options for the included skills:
### chatgpt.py
`OPENAI_API_KEY` : The API key to OpenAI, from OpenAI.
`OPENAI_ORGANIZATION` : The Organization ID from OpenAI.
`RESPONSE_PREAMBLE` : Instructions to ChatGPT for how it should respond and behave, given as a preamble for any conversation with it. A default preamble is provided (see [persona/skills/chatgpt.py](chatgpt.py).
2023-04-30 04:54:02 +00:00
## Writing Skills
Writing new skills is simple. Copy a skill from the [persona/skills/](skills) folder to a different name and modify these three functions:
`match_intent` : This should return true if your skill should respond to a message
`respond` : Return a message object to a chat
`generate` : Create a new message object to be sent to a chat
Additional you can use these two functions to start up and shut down your skill:
`startup` : Do any work your skill needs to get ready
`shutdown` : Do any work your skill needs to clean up
2023-04-11 05:51:34 +00:00
## Justification
2023-04-11 05:55:23 +00:00
Initially all I wanted to do was translate Apple Music links to Spotify links and vice-versa. But building platforms is more fun than building tools.