CompileBot is a reddit bot that can execute source code in comments. All you have to do is mention CompileBot in your comments along with a language and source code:
print "Hello World!"
CompileBot will then process your comment, execute it remotely, and then respond with the output:
- You can view more information on how to use compilebot on the compilebot wiki.
- Try compilebot out on reddit
How it works
CombileBot is powered by the "compilebot" module which is written in python (2.7). It uses the PRAW package to communicate with reddit and a modified fork of the python ideone-api which uses the Ideone online compiler to execute source code.
CompileBot would appreciate any help it can get. Even if you don't want to contribute to the compilebot source, we need people for testing, improving documentation, and making donations to help support CompileBot's server space and ideone subscription. For more details on contributing anything non-technical, you can find out more on the CompileBot contribution wiki.
If you would like to contribute new features, or fix bugs, or contribute anything else to the compilebot module, you can follow the instructions below to get a local instance of compilebot set up on your system.
To install compilebot locally, you can follow the following steps. Using virtualenv is recommended.
git clone https://github.com/renfredxh/compilebot.git cd compilebot
You'll need to initialize the ideone-api submodule and install it:
git submodule init git submodule update cd lib/ideone-api/ python setup.py install
Install the dependencies:
pip install -r requirements.txt
Now that all of the dependencies for compilebot have been installed, you'll have to configure the settings file. You can copy the included sample settings into a new file. From the main directory:
cd compilebot cp sample-config.yml config.yml
Now, if you open
config.yml in your favorite text editor you'll see customizable data for compilebot to use. If you would like to run all of compilebot's features, you'll need a reddit account and a ideone account. Once you have your login credentials, you can edit
config.yml and fill in the following fields:
reddit_user: # Your reddit user name reddit_pass: # Your reddit password ideone_user: # Your ideone username ideone_pass: # Your ideone password
Finally, try running compilebot:
If you would like to test any changes, you can run the compilebot test suite in order to test each function. From the directory that contains compilebot.py, you can run all of the test modules:
python -m tests.all
Or just the unit tests:
python -m tests.unit
Or a single test module:
python -m tests.unit.reply