Skip to content

QEDK/goodbot

Repository files navigation

goodbot Build Status CodeQL

A chat(help)bot for Wikimedia Zulipchat.

Directory guide

  • goodbot
    • bots
      • goodbot.py Zulip chatbot
      • ircbot.py Zulip-IRC bridgebot
      • parsebot.py GitHub bot that dynamically parses pages
    • config
      • config.json Parameterized values modifiable with goodbot
    • templates
      • faq.json FAQs for matching
      • projects.json Automatically generated by parsebot
      • replies.json Templated replies
    • app.py Web app that serves the landing page and webhooks
    • index.html Landing page for goodbot

Installation

It is recommended you use a virtual environment for building the project (such as Python's venv or the virtualenv module) to easily manage dependencies.

$ git clone git@github.com:QEDK/goodbot.git
$ cd goodbot
$ pip3 install -r requirements.txt

Dependencies for parsebot and the web app are found in requirements-parsebot.txt and requirements-web.txt respectively. Tests won't pass unless the latter file is installed.

$ pip3 install -r requirements-parsebot.txt
$ pip3 install -r requirements-web.txt

For running tests (you need to install flake8 beforehand for linting), run these commands inside the goodbot directory and it will automatically run the tests for you:

$ flake8 --ignore=W191,E117,E501 bots
$ nosetests

Basic configuration

goodbot will work with the zuliprc file provided by Zulip, provided that the template and configuration files are accessible and in valid JSON schema. ircbot uses a modified zuliprc-style file along the lines of:

[api]
email=emailaddress@zulipchat.com
key=topsecretapikey
site=https://wikimedia.zulipchat.com

[irc]
server=irc.freenode.net
nickname=ircnick
channel=#ircchannel
nickserv_password=yourtopsecretpassword
stream=zulipstreamtobridge
topic=topicofstreamtobridge

Note the added [irc] section. It's also possible to use the same Zulip credentials (bot account basically) for both the bots and use one file.

Running the bots

The bots are essentially Python scripts at its core, so you would run it as you would run a normal script on your system, for e.g. from the goodbot directory:

$ python3 bots/goodbot.py

Running the web app

The web app requires usual Flask setup like:

$ export FLASK_APP=app.py
$ flask run
 * Running on http://127.0.0.1:5000/

Detailed instructions are available in Flask docs.

Advanced configuration and documentation

Further documentation exists on the wiki.

Style guidelines

Style guidelines are available on the wiki.

License

Licensed under either of

at your option.

The documentation is released under the GFDL license v1.3 or later.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the LGPL-3.0 license, shall be dual licensed as above, without any additional terms or conditions.