Metadata | |
---|---|
cEP | 13 |
Version | 1.0 |
Title | cobot Enhancement and porting |
Authors | Meet Mangukiya mailto:[email protected] |
Status | Proposed |
Type | Process |
This cEP describes the details of the process of porting cobot from hubot(coffeescript framework) to errbot(python framework) and about the new features that are to be added to cobot as a part of the GSoC project.
coala community has grown substantially over last few months. To make it easier on maintainers to cope up and still be a welcoming community for new contributors, cobot is used. Currently, cobot is a hubot instance, scripts for which are written in Coffeescript.
coala is a python-inclined community, it makes sense to write the coala automation bot plugins in python. Writing the bot in python framework will appeal to more contributors and hence leading to more contributions. Also, having a python framework allows writing well tested plugins so buggy plugins are not merged. In cobot-hubot such merges have occured because the scripts in cobot-hubot weren't written with tests.
Errbot has many useful features:
- Internal support for webhooks.
- pytest testing plugin.
- Support for multiple backends.
- Logs can be accessed via chat
- Plugins can be enabled, disabled without having to interact with the server, via chat.
- One can write plugins that can manage other plugins, opens many possibilities.
- Allows writing complex plugins that requires some statefulness through
flows
.
One other competitive alternative for errbot: chatterbot. It has built in support for AI and ML. It is stateful. But it is not useful for searching and answering over technical documentation. Also, it is more useful for casual conversations, etc.
Construct the url from the search string and return it as a message.
> cobot search api|user this is a search string
Have a look at this : http://api.coala.io/en/latest/search.html?q=this+is+a+search+string
Query webservices.coala.io according to the filters that are applied/acquired from the trigger command.
When this command is triggered, plugin will use the lang argument as a filter to filter out the bears according to language. The list of bears will be retrieved from webservices.coala.io/list/bears.
> cobot ls bears [lang]*
### lang1
1. ...
2. ...
3. ...
### lang2
1. ...
2. ...
3. ...
See more at <link>
Query the webservices at appropriate end point according to the stat requested.
Endpoints:
/list/bears
for both bear and language stats. Language stats will be computed from the languages key of the given object./contrib
for contribution stats.
> cobot contrib stats <user>
User @<user> has:
1. Opened x issues
2. commited y commits
3. done z reviews
> cobot bear stats [lang]
There are x bears for [lang]
> cobot bear stats
There are total x bears.
> cobot lang stats
coala supports x languages.
> cobot stats
coala supports x bears across y languages.
Query the webservices with the parsed and retrieved code from the message and pass it along with the bears to be ran. Print the response that contains the diffs and results appropriately as a message.
> cobot run BearName setting1=value setting2=value ...
..BearName2 setting1=value setting2=value ...
It is always better to make and use API wrapper rather than making raw API calls. The API wrapper can be generated using WSDL(web services description language) reducing work. Maybe python-zeep can be used.
from errbot import BotPlugin, botcmd
class HelloWorld(BotPlugin):
@botcmd
def hello(self, msg, args):
return "Hello world!!"