2

我正在尝试按照 Errbot 指南创建一个新的 HelloWorld 插件。但是,在我的 errbot 成功连接到 HipChat 后,我​​无法看到我创建的新插件。这是控制台的调试输出。

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 │ 聊天室 │ ├────────┼──────────── ────┤ │ A │ 流动 │ ├────────┼────────────────┤ │ A │ 健康 │ ├─────── ─┼────────────────┤ │ A │ 帮助 │ ├────────┼──────────────── ┤ │ A │ 插件 │ ├────────┼────────────────┤ │ A │ Utils │ ├────────┼── ────────────┤ │ A │ VersionChecker │ ├────────┼──────────────┤ │ C │网络服务器│ └────────┴──────────────┘ A = 已激活,D = 已停用,B = 黑名单,C = 需要配置负载 0.02, 0.01, 0.0 GC 0->211 1->0 2->4

我看过这个问题,但它不是很有帮助。

这是 helloworld.py 的代码

from errbot import BotPlugin, botcmd, arg_botcmd, webhook

class Helloworld(BotPlugin): """ Hello world 等测试学习"""

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

任何指针将不胜感激!

4

0 回答 0