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:
+/u/CompileBot python
print "Hello World!"
CompileBot will then process your comment, execute it remotely, and then respond with the output:
Output:
Hello World!
- You can view more information on how to use compilebot on the compilebot wiki.
- Try compilebot out on reddit
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 with contributing with 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, 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 praw:
pip install praw
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 settings-sample.json settings.json
Now, if you open settings.json
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 settings.json
and fill in the following fields:
"reddit_user": "<your reddit username>",
"reddit_pass": "<your reddit password>",
"ideone_user": "<your ideone username>",
"ideone_pass": "<your ideone password>",
Finally, try running compilebot:
python compilebot.py
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.run_all
The reply functions module tests a good amount of the compilebot functions and does not require any login requests. If you're only would like to run the reply functions:
python -m tests.test_reply
Disclaimer: the tests cases may not be perfect. The tests are written in a mostly white-box style and there is room for improvement. If you think a test is incorrect or would like to contribute improvements, please feel free to.