Added admin interface to manage channels and enabled plugins (#9)

* Added base admin login/logout flows

* Ignore local database

* Channel model

* Admin interface for channels and plugins

* Added database tests along with workflows

* Added some docstrings

* Ignore .coverage file

* Creating plugins docs WIP

* Documentation

* Black everything

* Some documentation

* Coverage for the plugins package as well

* DB Fixes

* Absolute FROM in Dockerfile

* Database and logging fixes

* Slack: Support private channels

* Added pre-commit

* black'd

* Fixed UserQuery.create

* Fixed ChannelPluginQuery.create exists call

* Added ChannelPlugin menu for debugging

* Ignore sqlite databases

* Updated contributing docs
This commit is contained in:
Felipe M 2022-02-05 13:00:20 +01:00 committed by GitHub
parent 456d144a7d
commit 57b413dd1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 2210 additions and 421 deletions

8
docs/README.md Normal file
View file

@ -0,0 +1,8 @@
# Butterrobot Documentation
## Index
- [Contributing](./contributing.md)
- [Platforms](./platforms.md)
- Plugins
- [Creating a Plugin](./creating-a-plugin.md)
- [Provided plugins](./plugins.md)

23
docs/contributing.md Normal file
View file

@ -0,0 +1,23 @@
## Contributing
To run the project locally you will need [poetry](https://python-poetry.org/).
```
git clone git@github.com:fmartingr/butterrobot.git
cd butterrobot
make setup
```
Create a `.env-local` file with the required environment variables, you have [an example file](.env-example).
```
SLACK_TOKEN=xxx
TELEGRAM_TOKEN=xxx
...
```
And then you can run it directly with poetry:
```
poetry run python -m butterrobot
```

37
docs/creating-a-plugin.md Normal file
View file

@ -0,0 +1,37 @@
# Creating a Plugin
## Example
This simple "Marco Polo" plugin will answer _Polo_ to the user that say _Marco_:
``` python
# mypackage/plugins.py
from butterrobot.plugins import Plugin
from butterrobot.objects import Message
class PingPlugin(Plugin):
name = "Marco/Polo"
id = "test.marco"
@classmethod
def on_message(cls, message, **kwargs):
if message.text == "Marco":
yield Message(
chat=message.chat, reply_to=message.id, text=f"polo",
)
```
``` python
# setup.py
# ...
entrypoints = {
"test.marco" = "mypackage.plugins:MarcoPlugin"
}
setup(
# ...
entry_points=entrypoints,
# ...
)
```

8
docs/platforms.md Normal file
View file

@ -0,0 +1,8 @@
## Supported platforms
TODO: Create better actions matrix
| Name | Receive messages | Send messages |
| --------------- | ---------------- | ------------- |
| Slack (app) | Yes | Yes |
| Telegram | Yes | Yes |

11
docs/plugins.md Normal file
View file

@ -0,0 +1,11 @@
## Provided plugins
### Development
- `!ping`: Say `!ping` to get response with time elapsed.
### Fun and entertainment
- Lo quito: What happens when you say _"lo quito"_...? (Spanish pun)
- Dice: Put `!dice` and wathever roll you want to perform.