Difference between revisions of "User:Zai Lynch/Bot setup"

From Second Life Wiki
Jump to navigation Jump to search
m (artefacts)
m
 
(One intermediate revision by the same user not shown)
Line 7: Line 7:
<div style="padding: 0.5em">
<div style="padding: 0.5em">
This is the documentation page - as well as my personal notepad - for the wiki bot named [[User:Wiki Scribe|Wiki Scribe]]. It's relaying on the [http://pywikipediabot.sourceforge.net/ Python Wikipedia Robot Framework] and I'm trying to use it for maintenance issues.
This is the documentation page - as well as my personal notepad - for the wiki bot named [[User:Wiki Scribe|Wiki Scribe]]. It's relaying on the [http://pywikipediabot.sourceforge.net/ Python Wikipedia Robot Framework] and I'm trying to use it for maintenance issues.
See [[User:Zai_Lynch/Bot_setup/i18n]] for bot use related to the [[CT Projects]].
</div></div>
</div></div>


Line 60: Line 62:
   
   
     def version(self, code):
     def version(self, code):
         return "1.14.0"  # The MediaWiki version used.
         return "1.14.1"  # The MediaWiki version used.
   
   
     def scriptpath(self, code):
     def scriptpath(self, code):
Line 97: Line 99:


fixes['slterms'] = {
fixes['slterms'] = {
     'regex': True,
     'regex': False,
     'msg': {
     'msg': {
         '_default':u'Robot: fixing common SL terms',
         '_default':u'Robot: fixing common SL terms',
     },
     },
     'replacements': [
     'replacements': [
         (r' SLURL ', r" SLurl "),
         (' SLURL ', " SLurl "),
         (r' resident ', r" Resident "),
         (' resident ', " Resident "),
         (r' residents ', r" Residents "),
         (' residents ', " Residents "),
         (r' lindenlab ', r" Linden Lab "),
         (' lindenlab ', " Linden Lab "),
         (r' Linden Labs ', r" Linden Lab "),
         (' Linden Labs ', " Linden Lab "),
         (r' secondlife ', r" Second Life "),
         (' secondlife ', " Second Life "),
         (r' SecondLife ', r" Second Life "),
         (' SecondLife ', " Second Life "),
     ]
     ]
}
}

Latest revision as of 14:10, 17 August 2009

What's this?

This is the documentation page - as well as my personal notepad - for the wiki bot named Wiki Scribe. It's relaying on the Python Wikipedia Robot Framework and I'm trying to use it for maintenance issues.

See User:Zai_Lynch/Bot_setup/i18n for bot use related to the CT Projects.

Configuration Files

user-config.py <python> family = 'slwiki' mylang = 'en' usernames['slwiki']['en'] = 'Wiki Scribe' </python>

families/slwiki_family.py <python>

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

import family

class Family(family.Family):

    def __init__(self):
        family.Family.__init__(self)
        self.name = 'slwiki' # family name
        self.langs = {
            'en': 'wiki.secondlife.com', # host
        }

        self.namespaces[4] = {
            '_default': u'Project', # 
        }

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

        self.namespaces[100] = {
            '_default': u'Linden Lab Official', 
        }

        self.namespaces[101] = {
            '_default': u'Linden Lab Official talk', 
        }

        self.namespaces[274] = {
            '_default': u'Widget', 
        }

        self.namespaces[275] = {
            '_default': u'Widget talk', 
        }

    def version(self, code):
        return "1.14.1"  # The MediaWiki version used.

    def scriptpath(self, code):
        return '/w' # relative path of api.php 

</python>

Tasks

The custom fixes for replace.py are stored in user-fixes.py. This is the file I've written and tested so far. It will change over time while I'm learning to use regular expressions and while I'm stumbling upon new tasks. <python>

  1. -*- coding: utf-8 -*-
  1. user-fixes.py for Wiki Scribe
  2. written by Zai Lynch


  1. fix for links:

fixes['links'] = {

   'regex': True,
   'msg': {
       '_default':u'Robot: link fixes',
   },
   'replacements': [
       (r'<a href=\"https?://(www\.)?wiki.secondlife.com/wiki/(.*?)\"(.*?)>(.*?)</a>', r"\4"),
       (r'<a href=\"(.*?)\"(.*?)>(.*?)</a>', r"[\1 \3]"),
       (r'\[https?://(www.)?wiki.secondlife.com/wiki/(.*?) (.*?)\]', r"\3"),
   ]

}

  1. fix for common SL terms

fixes['slterms'] = {

   'regex': False,
   'msg': {
       '_default':u'Robot: fixing common SL terms',
   },
   'replacements': [
       (' SLURL ', " SLurl "),
       (' resident ', " Resident "),
       (' residents ', " Residents "),
       (' lindenlab ', " Linden Lab "),
       (' Linden Labs ', " Linden Lab "),
       (' secondlife ', " Second Life "),
       (' SecondLife ', " Second Life "),
   ]

}

  1. fix for German quotation marks
  2. not bullet proof, but a good start

fixes['gq'] = {

   'regex': True,
   'msg': {
       '_default':u'Robot: fixing German quotes',
   },
   'replacements': [
       (r'([^=])\"([^>])(.*?)([^=])\"([^>])', ur"\1„\2\3\4”\5"),
   ]

}

</python>