Giter Site home page Giter Site logo

webqabot's Introduction

webqabot

license Build Status

webqabot is a chat bot built on the Hubot framework for use in the #mozwebqa IRC channel.

Running webqabot Locally

You can test webqabot by running the hubot command in the bin folder:

% bin/hubot

webqabot expects at least the HUBOT_BUGZILLA_URL environment variable to exist, so you can either set that in your environment, or you can run the command setting that variable explicitly:

% HUBOT_BUGZILLA_URL=https://bugzilla.mozilla.org bin/hubot

You'll see some start up output and a prompt:

[Tue Oct 06 2015 10:58:42 GMT-0400 (EDT)] INFO hubot-redis-brain: Using default redis on localhost:6379
webqabot>

Then you can interact with webqabot by typing webqabot help.

webqabot> webqabot help
webqabot help - Displays all of the help commands that webqabot knows about.
webqabot ping - Reply with pong
...

Testing webqabot

The unit tests can be run via the command line with the command:

npm test

Deploying to Heroku

webqabot is deployed to Heroku. If you need to deploy a new instance of webqabot you will need to define the following environment variables via the Heroku UI or command line client:

  • HUBOT_BUGZILLA_URL - The url to the instance of Bugzilla that you use. Current value: https://bugzilla.mozilla.org
  • HUBOT_GITHUB_EVENT_NOTIFIER_ROOM - The name of the chat room in which you wish to notify GitHub events. Current value: #mozwebqa
  • HUBOT_GITHUB_EVENT_NOTIFIER_TYPES - The types of GitHub events about which you wish to be notified. Current value: issues, push, pull_request
  • HUBOT_IRC_NICK - The nick for the bot. Current value: webqabot
  • HUBOT_IRC_ROOMS - A list of rooms which you want the bot to join. Current value: #mozwebqa
  • HUBOT_IRC_SERVER - The IRC server to which you want the bot to connect. Current value: irc.mozilla.org
  • HUBOT_WELCOME_MESSAGE - The message to use to greet new people who join the channel. Current value: Hey {nick}, welcome to our channel! If you want to know more about our team, visit https://quality.mozilla.org/teams/web-qa/

You will also need to add a Redis add-on, such as Heroku Redis

Setting up GitHub Webhooks

A hook needs to be added to each GitHub repository about whose activity you wish webqabot to report. To do this, go to the repository settings page in GitHub, choose Webhooks & services, then choose Add a webhook. From the Add webhook page, specify https://webqabot.herokuapp.com/hubot/gh-repo-events as the Payload URL, and choose Let me select individual events. Choose the Issues, Pull Request and Push events. Click the Add webhook button to save your new webhook.

Contributing to the bot

The internal logic of the bot, for the most part, can be found in scripts/webqa.coffee, so if you want to make any changes or add any features, that is the best place to start. You may also want to check out the Hubot Scripting Guide.

The responses the bot uses are located in the resources/responses.properties file.

Unit tests for the bot are located in the tests/test_webqa.coffee file. The context 'hubot responding to events' is where you add tests that test if the bot responds to events created by another script (such as cron-jobs.coffee). The context 'hubot responding to user messages' is where you add tests that test if the bot responds to messages sent by a user. If your test does not fall under those two categories then please create a new context and add your test there.

external-scripts

There will inevitably be functionality that everyone will want. Instead of including this in webqabot's internal scripts, you can either create your own external script, or use one that someone else has already created.

Hubot is able to load plugins from third-party npm packages. You can get a list of available hubot plugins on npmjs.com or by using npm search:

% npm search hubot-scripts panda
NAME             DESCRIPTION                        AUTHOR DATE       VERSION KEYWORDS
hubot-pandapanda a hubot script for panda responses =missu 2014-11-30 0.9.2   hubot hubot-scripts panda
...

To use a package, check the package's documentation, but in general it is:

  1. Use npm install --save to add the package to package.json and install it.
  2. Add the package name to external-scripts.json as a double quoted string.

Note: Please add your new package to the above files maintaining the alphabetical order of the packages.

You can review external-scripts.json to see what is currently used by webqabot.

webqabot's People

Contributors

bobsilverberg avatar davehunt avatar monicag avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.