Errbot:如何访问配置文件变量

Errbot: How can I access config file variables

我在 cli.py 中看到了它的完成方式,但它没有设置为供插件代码使用的实用程序。

来自 http://errbot.io/en/latest/user_guide/plugin_development/configuration.html :

Errbot can keep a simple python object for the configuration of your plugin. This avoids the need for admins to configure settings in some kind of configuration file, instead allowing configuration to happen directly through chat commands.

但是,我喜欢配置文件!如果可能的话,我更喜欢用它们来做一些事情。

当然,config.py 模块在插件中公开为 self.bot_config

这样做有 2 个注意事项:

  1. 您将无法更改此配置 "on the fly",您需要重新启动整个机器人,而不仅仅是重新加载插件
  2. 您的插件无法通过 !repos install 安装,人们也需要停止该机器人。

作为替代方案,如果您想制作安装脚本,您可以使用配置 cli。