GithubHelp home page GithubHelp logo

oab00 / gitterbot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dcsan/gitterbot

0.0 2.0 0.0 13.1 MB

GitterBot / gitter chatbot with Wiki integration, and more!

Home Page: https://gitter.im/dcsan/gitterbot

JavaScript 92.03% Shell 2.58% CSS 0.24% HTML 3.50% Batchfile 0.04% CoffeeScript 1.61%

gitterbot's Introduction

GitterBot!

This is a full featured bot for Gitter. Main features:

  • integration with github Wiki
  • search, find
  • wrapper for commands

Gitter

The GBot is integrated into FreeCodeCamp

Join us in Gitter to discuss! https://gitter.im/dcsan/gitterbot

Introducing GitterBot!

GitterBot is a full featured bot for Gitter.im First developed to integrate with the chatrooms for FreeCodeCamp, the largest online bootcamp in the world, where he supports more than 15,000 users in the main chatroom.

Github Wiki Search

You can search for articles in a projects github wiki

Share wiki summaries in chat

Use explain to pull a wiki summary right into the chat:

Points system

Allow your users to send points to each other to say 'thanks @friend'

Fixed messages

Based on scannable expressions, send messages into the chat.

Extensible

Custom functions can easily be added. Check the System overview
or contact RIKAI Labs.

Installation instructions

To run GitterBot, you need Node.js before downloading the app.

Windows

To install Node.js on Windows, follow these instructions: http://blog.teamtreehouse.com/install-node-js-npm-windows.

  • To make your file changes update the local server automatically, install nodemon in an administrator console. npm install -g nodemon

  • To download the app, clone the repository the bot is in:

     git clone https://github.com/dcsan/gitterbot.git
    
  • Run the following commands to run the app:

    cd gitterbot
    cd nap
    ren dot-EXAMPLE.env dot.env
    nodemon app.js
    
  • That's it! The app should be running at http://localhost:7891.

You can now chat to your gitterbot via Gitter at https://gitter.im/demobot/test

Mac

  • To install Node, follow the instructions here: http://blog.teamtreehouse.com/install-node-js-npm-mac

  • To make your file changes update the local server automatically, install nodemon in an administrator console. sudo npm install -g nodemon

  • To download the app, clone the repository the bot is in:

      git clone [email protected]:dcsan/gitterbot.git
    
  • Run the following commands to run the app:

      cd gitterbot
      cd nap
      cp dot-EXAMPLE.env dot.env
      nodemon app.js
    
  • That's it! The app should be running at http://localhost:7891.

You can now chat to your gitterbot via Gitter at https://gitter.im/demobot/test

Getting your own appID

This is using shared login as "demobot" so you may find yourself in a chatroom with other people using the same ID!

To setup this up and use your own gitter login info, you should create your own Gitter API key on their developer site, and replace the info in that .env file. Get your own API keys for gitter from: https://developer.gitter.im/apps

For more settings info, checkout the AppConfig.js and RoomData.js files. These define which rooms the bot will listen in to. You can ping us in the Dev Chatroom if you have problems gitterbot chatroom .

Running tests

There are other commands in bin for running tests with the right config files etc To run the tests with the right configs

$ bin/test.sh

Wiki Content

The wiki content is pulled in from FCC's wiki using a git submodule But then we just copy it and commit it back to the main app as submodules are nasty to deal with on production servers.

bin/wiki-update.sh

System Overview

data/RoomData.js

The list of rooms your bot is going to join. Very starting your own bot, create a test room to enter and debug with. This needs to be changed so you would only join your own rooms, otherwise developers will get into a situation where everyone is joining the same rooms and the bots go crazy talking to each other!

lib/bot/BotCommands.js

This is where you add things that the bot can do. Some commands are broken into separate files such as cmds/thanks and cmds/about. Each command gets a input which is a blob of data including what the user entered, and a bot instance.

KBase.js

The Knowledge base. This is an interface to all the data in the wiki.

How commands are called

In GBot.js

    if (input.command) {
        // this looks up a command and calls it
        output = BotCommands[input.keyword](input, this);
    } else {

BotCommands is a list of functions, eg

BotCommands.thanks = function() { ... }

where input.keyword is thanks then

BotCommands[input.keyword] is like saying BotCommands.thanks()

so then the params get also added in (input, this) so its

BotCommands[input.keyword](input, this);
//becomes
BotCommands.thanks(input, bot);

All of the botCommands expect these two params eg in thanks.js

var commands = {
    thanks: function (input, bot) {

environment notes

wiki data

we use git submodules for some wiki data. to get these submodules you would do:

git submodule init
git submodule update

ES6 and iojs

we're using the latest es6 so best to get an up to date environment. at the time of writing iojs was a bit ahead of node. its recommended to run on iojs rather than the older node.

# ubuntu
sudo apt-get upgrade
sudo apt-get install build-essential

we're using n to update node article We use n to manage iojs and node:

sudo npm install -g n
sudo n io latest
iojs -v
    // should be at least v2.4.0

Chat to us!

Ping me @dcsan in the gitterbot chatroom if you get stuck.

gitterbot's People

Contributors

abhisekp avatar benmcmahon100 avatar dcsan avatar dting avatar irinatag avatar kirah1314 avatar oab00 avatar opatel99 avatar

Watchers

 avatar  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.