User:Kernigh bot

From NetHackWiki
Revision as of 03:23, 24 February 2008 by Kernigh (talk | contribs) (pywikipediabot setup in progress.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This is a bot operated by Kernigh.


I am trying to configure a pywikipediabot on this user account. This bot will play with the Wikihack:Sandbox. It does not yet have another task. --Kernigh 03:23, 24 February 2008 (UTC)

pywikipediabot setup procedure

Start with a Unix system that has python and svn commands. I am using OpenBSD with Python 2.4.4 (with python symlinked to python2.4, as instructed by pkg_info -M python) and Subversion 1.4.4.

(first) acquire pywikipediabot scripts

Find a place for the pywikipediabot scripts and run the command:

svn co http://svn.wikimedia.org/svnroot/pywikipedia/trunk/pywikipedia/

I received revision 5073. Now enter the directory of scripts:

cd pywikipedia

(second) configure nethack.wikia family

Unfortunately, to teach the bot to find nethack.wikia.com requires the creation of a new python class for the new "nethack_wikia" family.

Into families/nethack_wikia.py, put this content:

# -*- coding: utf-8 -*-

import family

# Wikihack, a free community web site and one big spoiler for NetHack.

class Family(family.Family):

	def __init__(self):
		family.Family.__init__(self)
		self.name = 'nethack_wikia'
		self.langs = {
			'en': 'nethack.wikia.com',
		}
		self.namespaces[4] = {
			'_default': u'Wikihack',
		}
		self.namespaces[5] = {
			'_default': u'Wikihack talk',
		}
		self.namespaces[16] = {
			'_default': u'Source',
		}
		self.namespaces[17] = {
			'_default': u'Source talk',
		}
		self.namespaces[18] = {
			'_default': u'Forum',
		}
		self.namespaces[19] = {
			'_default': u'Forum talk',
		}

	def version(self, code):
		return "1.12alpha"

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

(You may want to check Special:Version for the current version, but pywikipediabot's documentation claims that the version is mostly not important.)

(third) give account to bot

Use Special:Userlogin to create a Wikia user account for your bot. (After you do this, remember logout your bot account and login your normal account.)

Into user-config.py, put this content:

mylang = 'en'
family = 'nethack_wikia'
usernames['nethack_wikia']['en'] = u'Kernigh bot'

Replace 'Kernigh bot' with the username for the account of your bot.