2015-10-04

Errbot recipes

I presented at the last SF chatops meetup an introduction to errbot. I realized that the snippets used during the presentation could be a nice set of "recipes" that could get you started to use a specific feature. So here they are all in one page, enjoy !

Note: I tried to not repeat the files too much so you can use the .plug file from the first example for all the other ones.


#1 How to make a minimal plugin

This is a minimal plugin that just uppercases your input.





#2 How to add a dependency

This shows how to use a third party library from pypi, a standard requirements.txt is enough.
Note: this also shows how to format your output with markdown.



#3 How to add help

This show how to add some online help to your plugin.



#4 How to use templates


You can use template to generate your markdown output. Here is how. Note: templates needs to be in a templates directory relative to the .plug file.





#5 How to parse argument


This shows how to ask errbot to parse the arguments of the command automatically. This is only a simple split but others are available: argcmd, regexps, subcommands.






#6 How to send messages asynchronously


This is useful for example to show intermediate progress of a long command.





#7 How to create a poller


A poller will callback at regular interval your plugin. It is useful to check regularly a state and react to a change.




#8 How to create a webhook on which the bot can be callbacked


This is useful to receive notifications from third party services like github etc...




#9 How to persist information


Sometimes you need to store information that can resist bot restarts to reboots.






No comments:

Post a Comment