NetHackWiki:WikiBot
Contents
Bots on NetHackWiki
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 NetHackWiki 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 <yourname>Bot.
Bot Setup
NetHackWiki uses MediaWiki, the same software that runs wikipedia. Therefore the pywikipedia bot can be used on NetHackWiki. '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.
NetHackWiki Setup
- Create the bot account.
- Use <YourName>Bot as the username.
- Write down the password.
- Ensure the display skin is set to Monobook (default skin).
- 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 NetHackWiki.
- Download and install Python. ActiveState has a good package
- Download and install CVS. TortoiseCVS is a good package for MS Windows.
- Read TortoiseCVS User's Guide - Chapter 2. Checking out a Module
- Checkout pywikipedia. Refer to CVS Connection Parameters below.
- or paste into CVSROOT field :pserver:anonymous@pywikipediabot.cvs.sourceforge.net:/cvsroot/pywikipediabot
Protocol | pserver |
Server | pywikipediabot.cvs.sourceforge.net |
CVS Root (Repository Folder) | /cvsroot/pywikipediabot |
User | anonymous |
Password | (leave empty, anonymous doesn't have any passwords) |
CVS Module | pywikipedia |
Configuring pywikipedia
Because NetHackWiki 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 NetHackWiki before attempting to login.
- Check if <bot root>\families\wikihack_family.py exists.
- If it does not, add wikihack_family.py (see below) to the families directory.
- Create <bot root>\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.
- Run command line python login.py -pass:XXXX
pywikipedia: Upload
- Run command line python upload.py -log -keep <filename> "<description>"
user-config.py
mylang = 'en' family = 'wikihack' usernames['wikihack']['en'] = 'ExampleBot'
wikihack_family.py
# -*- coding: utf-8 -*- import family # The wikiHack family - a wiki about the game NetHack. # 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': 'nethackwiki.com', # NetHackWiki 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'NetHackWiki', } # Project talk namespace. self.namespaces[5] = { '_default': u'NetHackWiki 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 'nethackwiki.com'