Wikihack:WikiBot

Bots on WikiHack
A wikiBot is a set of small programs (scripts) that automate wiki editing tasks. You should use a bot if you have a large number of edits that you need to perform. The bot takes care of repetitive and mundane tasks so you don't have to. Writing bot scripts requires good programming skills, but operating a bot is relativly easy.

On WikiHack anyone can run a bot. However, you must notify us on the [Community Forum] before doing so. It's considered good manners to run the bot from its own user account, usually Bot.

Bot Setup
WikiHack uses MediaWiki, the same software that runs wikipedia. Therefore the pywikipedia bot can be used on wikiHack. 'pywikipedia' is written in the Python scripting language. If you are not familiar with Python, Dive Into Python provides a quick introduction along with links to ActiveState where you can download a free turn-key install package for most platforms.

WikiHack Setup

 * 1) Create the bot account.
 * 2) Use Bot as the username.
 * 3) Write down the password.
 * 4) Ensure the display skin is set to Monobook (deafult skin).
 * 5) Log out you bot account.

Downloading pywikipedia
The pywikipedia bot does not have a turn-key install. It has to be downloaded and configured. The best way to get the latest release is via CVS. Once you have acquired the bot you'll need to configure it before it will run on wikiHack.


 * 1) Download and install Python. ActiveState has a good package
 * 2) Download and install CVS. TortoiseCVS is a good package for MS Windows.
 * 3) Read TortoiseCVS User's Guide - Chapter 2. Checking out a Module
 * 4) Checkout pywikipedia. Refer to CVS Connection Parameters below.
 * 5) or paste into CVSROOT field :pserver:anonymous@pywikipediabot.cvs.sourceforge.net:/cvsroot/pywikipediabot

Configuring pywikipedia
Because wikiHack is not wikipedia, the bot needs some additional code to work properly. Wikipedia has information on workarounds for non-wikipedia wikis. Basically we'll need to add a 'families' definition for wikiHack before attempting to login.


 * 1) Check if  \families\wikihack_family.py exists.
 * 2) If it does not, add wikihack_family.py (see below) to the families directory.
 * 3) Create  \user-config.py (see below)

Logging in pywikipedia
We start by giving the bot login access to the wiki. This is a one time procedure. Once logged in the bot will store the username and password in a cookie for future use. To cache a different user/pass combination delete the XX-login.data file that is created in the login-data subdirectory.


 * 1) Run command line python login.py -pass:XXXX

pywikipedia: Upload

 * Run command line python upload.py -log -keep " "

user-config.py
mylang = 'en' family = 'wikihack' usernames['wikihack']['en'] = 'ExampleBot'

wikihack_family.py
import family
 * 1) -*- coding: utf-8  -*-
 * 1) The wikiHack family - a wiki about the game NetHack.
 * 2) v1.0 - July 30, 2006. Bernard Martis

class Family(family.Family): def __init__(self): family.Family.__init__(self) self.name = 'wikihack'         # family name, same as filename self.langs = { 'en': 'nethack.wikia.com', # wikiHack hostname }

self.mainpages = { 'en': u'Main Page' }       # namespace not specified will be set to MediaWiki defaults # Project namespace. All languages use the same project namespace name. self.namespaces[4] = { '_default': u'Wikihack', }

# Project talk namespace. self.namespaces[5] = { '_default': u'Wikihack talk', }

# A few selected big languages for things that we do not want to loop over # all languages. This is only needed by the titletranslate.py module, so       # if you carefully avoid the options, you could get away without these # for another wiki family. self.biglangs = ['en']

# MediaWiki version used. Current as of Sun, 30-Jul, 06 def version(self, code): return "1.5"

# The path of index.php def path(self, code): return '/index.php'

# hostname. The same for all languages def hostname(self, code): return 'nethack.wikia.com'