Allow to load plugins
This commit is contained in:
parent
866029256a
commit
2526ce330d
|
@ -5,6 +5,7 @@
|
|||
- Allow to configure avatar from configuration file and environment
|
||||
- Load Redis details fron conf and CLI also ([#23](https://git.autonomic.zone/decentral1se/xbotlib/issues/23))
|
||||
- Migrate Redis environment naming: `REDIS_URL` -> `XBOT_REDIS_URL` ([#23](https://git.autonomic.zone/decentral1se/xbotlib/issues/23))
|
||||
- Allow to load custom plugins ([#24](https://git.autonomic.zone/decentral1se/xbotlib/issues/24))
|
||||
|
||||
# xbotlib 0.10.0 (2021-01-16)
|
||||
|
||||
|
|
10
README.md
10
README.md
|
@ -189,6 +189,16 @@ You should see `INFO Successfully connected to storage` when your bot
|
|||
initialises. Please see the `GlossBot` example for more on how to work with
|
||||
this type of storage.
|
||||
|
||||
## Loading Plugins
|
||||
|
||||
You can specify a `plugins = [...]` on your bot definition and they will be
|
||||
automatically loaded.
|
||||
|
||||
```python
|
||||
class MyBot(Bot):
|
||||
plugins = ["xep_0066"]
|
||||
```
|
||||
|
||||
## Roadmap
|
||||
|
||||
See the [issue tracker](https://git.autonomic.zone/decentral1se/xbotlib/issues).
|
||||
|
|
|
@ -361,6 +361,12 @@ class Bot(ClientXMPP):
|
|||
self.register_plugin("xep_0199") # XMPP Ping
|
||||
self.register_plugin("xep_0084") # User Avatar
|
||||
|
||||
try:
|
||||
for plugin in self.plugins:
|
||||
self.register_plugin(plugin)
|
||||
except AttributeError:
|
||||
self.log.info("No additional plugins loaded")
|
||||
|
||||
def init_db(self):
|
||||
"""Initialise the Redis key/value store."""
|
||||
if not self.redis_url:
|
||||
|
|
Loading…
Reference in New Issue