首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Errbot中正确设置插件的配置?

如何在Errbot中正确设置插件的配置?
EN

Stack Overflow用户
提问于 2018-06-08 13:44:37
回答 1查看 155关注 0票数 0

我试着遵循文档提供的示例:

9.1。通过内置!config命令进行插件配置

但是,我无法获得设置为'NoneType'的插件的配置。

代码语言:javascript
复制
[@admin ➡ @errbot] >>> !plugin config Samples
Default configuration for this plugin (you can copy and paste this directly as a command):
 !plugin config Samples
{'ID_TOKEN': '00112233445566778899aabbccddeeff', 'USERNAME': 'changeme'}


[@admin ➡ @errbot] >>> !mycommand
Computer says nooo. See logs for details:
 'NoneType' object is not subscriptable

[@admin ➡ @errbot] >>> !about
This is Errbot version 5.2.0

这是我的插件代码sample.py

代码语言:javascript
复制
from errbot import BotPlugin, botcmd

class Samples(BotPlugin):
    """Samples of plugins from Errbot documentation"""

    # 9. Configuration
    # 9.1. Plugin configuration through the built-in !config command
    def get_configuration_template(self):
        return {'ID_TOKEN': '00112233445566778899aabbccddeeff',
                'USERNAME':'changeme'}

    @botcmd
    def mycommand(self, mess, args):
        # oh I need my TOKEN !
        token = self.config['ID_TOKEN']

我不确定这是一个错误还是一个糟糕的配置。

溶液

给出的配置后,我不得不打电话

代码语言:javascript
复制
[@admin ➡ @errbot] >>> !plugin config Samples {'ID_TOKEN' : '00112233445566778899aabbccddeeff', 'USERNAME':'changeme'}
Plugin configuration done.

[@admin ➡ @errbot] >>> !mycommand
00112233445566778899aabbccddeeff

@gbin谢谢您的帮助

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-06-08 16:59:02

您需要发送带有json配置的config命令,这里errbot只告诉您需要做什么来配置它。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50762046

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档