Errbot: How can I access config file variables

471 Views Asked by At

I see the way it's done in cli.py but it's not set up as a utility for plugin code to make use of.

From 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.

But, I like config files! I prefer to use them for some things if possible.

1

There are 1 best solutions below

2
On BEST ANSWER

Sure, the config.py module is exposed as self.bot_config in the plugins.

There are 2 caveats doing that:

  1. You will not be able to change this config "on the fly", you'll need to restart the entire bot instead of just reloading the plugin
  2. Your plugin won't be installable with !repos install, people will need to stop the bot too.

As an alternative, if you want to make a setup script, you can use the provisioning cli.