ztatlock / crossbot

A slackbot to compete on mini crosswords (or any other daily challenge).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

crossbot

A Slack bot to make you really competitive on the New York Times mini crossword.

Installation

Clone the repo and install everything inside a virtualenv.

# clone and enter the repo
git clone git@github.com:mwillsey/crossbot.git
cd crossbot

# this would be a good time to make a virtual environment for isolation
# see below

# make an empty database if you haven't already
# this will *not* overwrite an existing database
sqlite3 crossbot.db < scripts/init_db.sql

# install and setup the package
pip install -r requirements.txt
python setup.py install

Isolation

To create a virtual environment, try virtualenvwrapper. The following command will create the virtual environment and immediately use it.

mkvirtualenv crossbot --python python3

If you don't want to install virtualenvwrapper, you can use plain old virtualenv. Just make sure to activate it before pip install.

virtualenv . --python python3
source bin/activate

Running the bot

To actually run the bot, you need to provide an API token and use the slack subcommand.

export SLACKBOT_API_TOKEN=<<your slack api token>>
crossbot.py slack

There are some settings in crossbot.py that you can play with to change, say, who the errors get reported to.

Messing around on the command line

You can now run crossbot on the command line! Just run crossbot.py help like you normally would on Slack. Pretty much all the functionality works. On the command line, you're a pretend user with id command-line-user.

Extending crossbot

There's pretty terrible (but somewhat functional) plugin architecture. Files in commands/ are automatically loaded. Check out commands/times.py to see how a simple command is implemented. You'll probably want to check out the Client class in client.py as well; that's what allows the commands to work the same over the shell or Slack.

When you're developing, make sure to run ./setup.py install to get crossbot.py to reflect your changes. If you add or rename files, you might want to do ./setup.py clean --all followed by ./setup.py install to have it start fresh.

About

A slackbot to compete on mini crosswords (or any other daily challenge).

License:GNU General Public License v3.0


Languages

Language:Python 97.6%Language:Stan 2.4%