User:WindBOT/Source

I am open-source, licensed under the GPL. That means you're free to see my code, run it, modify it, redistribute it, and even sell paid copies of me, as long as you keep the source open and report back all the modifications you've made, if any.

Dependencies
$ sudo apt-get install python2.6 $ wget 'http://upload.gaiatools.com/files/wikitools_mod.tar_0.gz' $ tar xfv wikitools*.tar.gz && rm wikitools*.tar.gz $ mv wikiUpload.py MultipartPostHandler.py `dirname "/path/to/bot.py"` $ cd wikitools* $ sudo python2.6 setup.py install $ sudo apt-get install cpulimit $ sudo apt-get install git $ git clone http://git.optf2.com/steamodd.git $ cd steamodd $ sudo python2.6 setup.py install $ sudo apt-get install pngcrush
 * I am a Python bot. That means you need Python 2.6. On Ubuntu:
 * I also need a modified version of wikitools to use the MediaWiki API. Comes with a separate hand-crafted module called wikiUpload to allow file uploading without MediaWiki 1.16. On Ubuntu:
 * (Optional) cpulimit can be used to limit the bot's often-high CPU usage when applying filters to a lengthy page, to ensure sufficient resources to other programs running concurrently on the server. This does slow the bot down but makes it act nicer to others, which is welcome on a shared host. On Ubuntu:
 * (Optional) steamodd can be used to communicate with the TF2 Web API. On Ubuntu:
 * (Optional) pngcrush can be used to crush PNG images in file filters. Without it, images will not be considered for crushing. On Ubuntu:

That's it!

File structure
chmod +x bot.py Both files have to be in the same directory. To run the bot, assuming Python is in your path and that you are in the bot's source directory: ./bot.py
 * : The bot's configuration. A sample configuration file is given below.
 * : The bot's core. Full source is given below. Make sure to make it executable:

botConfig.py (sample)
config = { 'api': 'http://theportalwiki.com/w/api.php', # API URL 'steamAPI': 'PootAPIKeyHeer', # Steam API key 'username': 'MyCoolBot', # Username 'password': 'LeetPassword0MG', # Password 'maxrequests': 16, # Max PageRequests to process per run 'rcidrate': 50, # Edit RCID every n edits 'freshnessThreshold': 300, # In seconds 'pagePasses': 8, # Maximum number of parsing/filtering passes 'filterPasses': 64, # Maximum number of times to run a fitler on a filtering pass 'pages': { 'filters': 'User:WindBOT/Filters', # Filters page 'blacklist': 'User:WindBOT/Blacklist', # Blacklist 'pagerequests': 'User:WindBOT/PageRequests', # PageRequests 'pagerequestsforce': 'User:WindBOT/PageRequestsForce', # PageRequests bypassing blacklist 'rcid': 'User:WindBOT/RCID', # RCID page 'editcount': 'User:WindBOT/EditCount' # Edit count page } }
 * 1) -*- coding: utf-8 -*-