Errbot: Как правильно настроить новые плагины?
Я пытаюсь следовать руководству Errbot, чтобы создать новый плагин HelloWorld. Однако после того, как мой errbot успешно подключился к HipChat, я не могу увидеть новый плагин, который я создал. Это вывод DEBUG с консоли.
16:44:02 INFO errbot.specific_plugin_ma storage search paths {'/home/eugine/errbot-root/plugins/learning', '/home/eugine/lib/python3.5/site-packages/errbot/storage', '/home/eugine/errbot-root/plugins/err-example'}
16:44:02 INFO errbot.specific_plugin_ma Found those plugings available:
16:44:02 INFO errbot.specific_plugin_ma Helloworld (/home/eugine/errbot-root/plugins/learning/helloworld.py)
16:44:02 INFO errbot.specific_plugin_ma Shelf (/home/eugine/lib/python3.5/site-packages/errbot/storage/shelf.py)
16:44:02 INFO errbot.specific_plugin_ma Memory (/home/eugine/lib/python3.5/site-packages/errbot/storage/memory.py)
16:44:02 INFO errbot.specific_plugin_ma Example (/home/eugine/errbot-root/plugins/err-example/example.py)
16:44:02 INFO errbot.bootstrap Found Storage plugin: 'Shelf'
Description: This is the storage plugin for the traditional shelf store for errbot.
16:44:02 DEBUG errbot.specific_plugin_ma Refilter the plugins...
16:44:02 WARNING yapsy Plugin candidate '/home/eugine/errbot-root/plugins/learning/helloworld.plug' rejected by strategy 'SpecificBackendLocator'
16:44:02 WARNING yapsy Plugin candidate '/home/eugine/lib/python3.5/site-packages/errbot/storage/memory.plug' rejected by strategy 'SpecificBackendLocator'
16:44:02 WARNING yapsy Plugin candidate '/home/eugine/errbot-root/plugins/err-example/example.plug' rejected by strategy 'SpecificBackendLocator'
16:44:02 DEBUG errbot.specific_plugin_ma Load the one remaining...
16:44:02 DEBUG errbot.specific_plugin_ma Class to load ShelfStoragePlugin
16:44:02 DEBUG errbot.storage Opening storage 'repomgr'
16:44:02 DEBUG errbot.storage.shelf Open shelf storage /home/eugine/errbot-root/data/repomgr.db
16:44:02 DEBUG errbot.storage Opening storage 'core'
16:44:02 DEBUG errbot.storage.shelf Open shelf storage /home/eugine/errbot-root/data/core.db
Это результат ввода "! Status" в приватном чате с ботом.
Yes I am alive...
Плагины
┃ ┃ Статус ┃ Имя ┃ ┡━━━━━━━━╇━━━━━━━━━━━━━━━━┩ │ A │ ACL │ ├───────────────────────────────┤ ┤ A │ Резервное копирование │ ├────────┼────────────────┤ │ A │ ChatRoom │ ├────────┼──────────── ────┤ │ A │ Потоки │ ├────────┼──────────────────────┤ │ A │ Здоровье │ ├─────── ─┼────────────────┤ │ A │ Помощь │ ├────────┼────────────────────── ┤ │ A │ Плагины │ ├────────┼──────────────── ┤ │ A │ Утилиты │ ├────────┼─────────────────────── │ A │ VersionChecker │ ├────────C── ──────────────┤ │ C │ Веб-сервер │ └────────┴──────────────────────┘ A = Активирован, D = деактивировано, B = в черном списке, C = необходимо настроить Load 0.02, 0.01, 0.0 GC 0->211 1->0 2->4
Я посмотрел этот вопрос, но он не очень помог.
Вот код для helloworld.py
from errbot import BotPlugin, botcmd, arg_botcmd, webhook
класс Helloworld(BotPlugin): """Привет, мир и другое тестирование и обучение" ""
def activate(self):
"""
Triggers on plugin activation
You should delete it if you're not using it to override any default behaviour
"""
super(Helloworld, self).activate()
def deactivate(self):
"""
Triggers on plugin deactivation
You should delete it if you're not using it to override any default behaviour
"""
super(Helloworld, self).deactivate()
def get_configuration_template(self):
"""
Defines the configuration structure this plugin supports
You should delete it if your plugin doesn't use any configuration like this
"""
return {'EXAMPLE_KEY_1': "Example value",
'EXAMPLE_KEY_2': ["Example", "Value"]
}
def check_configuration(self, configuration):
"""
Triggers when the configuration is checked, shortly before activation
Raise a errbot.utils.ValidationException in case of an error
You should delete it if you're not using it to override any default behaviour
"""
super(Helloworld, self).check_configuration(configuration)
def callback_connect(self):
"""
Triggers when bot is connected
You should delete it if you're not using it to override any default behaviour
"""
pass
def callback_message(self, message):
"""
Triggered for every received message that isn't coming from the bot itself
You should delete it if you're not using it to override any default behaviour
"""
pass
def callback_botmessage(self, message):
"""
Triggered for every message that comes from the bot itself
You should delete it if you're not using it to override any default behaviour
"""
pass
@webhook
def example_webhook(self, incoming_request):
"""A webhook which simply returns 'Example'"""
return "Example"
# Passing split_args_with=None will cause arguments to be split on any kind
# of whitespace, just like Python's split() does
@botcmd(split_args_with=None)
def example(self, message, args):
"""A command which simply returns 'Example'"""
return "Example"
@arg_botcmd('name', type=str)
@arg_botcmd('--favorite-number', type=int, unpack_args=False)
def hello(self, message, args):
"""
A command which says hello to someone.
If you include --favorite-number, it will also tell you their
favorite number.
"""
return "Hello, " + format(msg.frm)
Это код для helloworld.plug
[Core]
module = helloworld
name = Helloworld
[Documentation]
description = Hello world and other testing and learning
[Python]
version = 3
[Errbot]
min = 4.3.7
max = 4.3.7
Они были созданы с помощью командной строки errbot --new-plugin
Любые указатели будут высоко оценены!