Added a link to the Matrix Python SDK

This commit is contained in:
Dennis Potter 2019-01-06 13:19:33 +01:00
parent 3b0eed1bd4
commit 0c78434919
1 changed files with 3 additions and 2 deletions

View File

@ -22,6 +22,8 @@ The bot has different plugins that can be activated by sending `[Keyword in bot'
* [Admidio events plugin](src/branch/master/plugins/events)
### API
To interact with rooms, the [Matrix Python SDK](http://matrix-org.github.io/matrix-python-sdk/<Paste>) can be used.
#### Mandatory files
To create a plugin, a few mandatory files must be present. The tree below shows the general structure of a plugin. A new plugin must be placed in a directory with the same name. The main class (more on that later) of the plugin must be defined in a Python file with the same name within that directory. The event may not use bot's main configuration file. All configuration must be placed in a separate `config.json`.
@ -73,7 +75,7 @@ The code below shows the template for a simple plugin with a few features. The n
└── <pluginN>
```
* It has one method `thread_method1()` which is spawned and runs continuously in the background. **Please keep performance in mind when doing this!***. For example, is it actually necessary to continuously run the thread, or is execution only necessary every 5 minutes?
* For every sensitivity that is defined, a method must be defined that acts on it.
* For every sensitivity that is defined, a method must be defined that acts on it. The methods get a `room` and `event` object from the parent bot. These can be used to interact with the room. A full documentation on the [Matrix Python SDK](http://matrix-org.github.io/matrix-python-sdk/) can be found [here](http://matrix-org.github.io/matrix-python-sdk/).
* The Plugin class must contain a method `help()` which only returns the content of `plugin1/messages/help`
```python
CONFIG_LOCATION = os.path.join(os.path.dirname(__file__), 'config.json')
@ -135,4 +137,3 @@ class Plugin:
#### Additional tips
* Use [f-strings](https://www.python.org/dev/peps/pep-0498/#how-to-denote-f-strings) if possible.
...