1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
Development environment
=======================
Before we dive in and start writing our very first plugin, I'd like
to take a moment to show you some tools and features which help
facilitate the development process.
Loading plugins from a local directory
--------------------------------------
Normally, you manage and install plugins through the built-in
`!repos` command. This installs plugins by cloning them via git, and
allows updating of them through the `!repos update` command.
During development however, it would be easier if you could load
your plugin(s) directly, without having to commit them to a Git
repository and instructing Errbot to pull them down.
This can be achieved through the `BOT_EXTRA_PLUGIN_DIR` setting in
the `config.py` configuration file. If you set a path here pointing
to a directory on your local machine, Errbot will (recursively) scan
that directory for plugins and attempt to load any it may find.
Local test mode
---------------
You can run Errbot in a local single-user mode that does not require
any server connection by passing in the `--text` (or
`-T`) option flag when starting the bot.
In this mode, a very minimal back-end is used which you can interact
with directly on the command-line. It looks like this::
$ errbot -T
[...]
INFO:Plugin activation done.
Talk to me >> _
Plugin scaffolding
------------------
Plugins consist of two parts, a special `.plug` file and one or more Python (`.py`) files
containing the actual code of your plugin
(both of these are explained in-depth in the next section).
Errbot can automatically generate these files for you
so that you do not have to write boilerplate code by hand.
To create a new plugin, run `errbot --new-plugin`
(optionally specifying a directory where to create the new plugin -
it will use the current directory by default).
It will ask you a few questions such as the name for your plugin,
a description and which versions of errbot it will work with and
generate a plugin skeleton from this with all the information
filled out automatically for you.
|