Skip to content

wpp/xander

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xander

CircleCI

Getting Started

  1. Install Ruby (ruby 2.2.3p173)
  2. Install Bundler with gem install bundler
  3. cd ruby-app to swap to the main directory
  4. bundle install in the root directory of the project to install the required gems
  5. touch .testbot to create a blank API token file (you don't need a token unless you are running new tests)
  6. rake to run the tests!

Structure of the project

ruby-app/

Contains the main logic of Xander.

bot.rb

Initiates one instance of Xander, the Slack::RealTime::Client (web and rtm) and establishes the connection to the team. Make sure you have a valid Slack API token.

SLACK_API_TOKEN=xoxb-7776-LIVE-AM-MICROPHON ruby bot.rb

xander.rb

In get_response_for we decide which Response Xander returns for a certain message. Currently we rely on Regexe's to do that job. We simply iterate over all Responses and the first response which is triggered_by? by the message wins.

rubular.com is pretty handy for testing regexes.

responses/

The directory containing all responses.

If you want to add a new response, drop it in here. Your Response should inherit from Base and implement triggered_by?, help and text.

config/

Contains deployment/docker-related configuration files.

Adding a new response

So in summary, if you want to add a new response:

  1. Create a new test test/responses/my_new_response_test.rb
  2. Create a new response lib/responses/
  3. Run tests rake test or a single test (ruby -I lib -I test/ test/responses/help_test.rb)
  4. Commit
  5. Push

Other notes

I've not included the dictionaries for the markov chains, since they contain some team specific data I'm not comfortable sharing atm.

As far as deployment goes, I'm hosting this on a VPS of mine atm. You can have a look at the Dockerfile to see what's included. (In case you want timing/cron related libs).

Resources

About

Xander is a Destiny Slack Bot

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages