User talk:HighInBC/Testing area

Welcome
All are welcome to participate in this project. Chillum 19:15, 10 April 2009 (UTC)

Description
This is going to be a generic "Do something" bot. The idea is that many of the tiny jobs we do can be ran off a single bot. The bot takes simple commands from a wiki page to configure itself and take actions.

You could make a script like this that would find every page with two categories and replace both of them with one like so:


 * Go:{true}
 * UseAccount:{Chillum}
 * LogActions:{User:Chillum/BLP cat migration log}
 * TemplateReplace:{hasCategories|unreferenced|Living people}{replaceWith|BLP unsourced}{editSummary|Merging BLP and unreferenced templates.}

The Go being set to true tells the bot it is time to act upon the script. You leave that set to false until you are sure your instructions are ready for the bot. As long as it is false then the bot will not run the script.

The UseAccount setting tells the script which of the pre-defined(in the config file) user credentials to use to log in. This command is needed if the bot is to edit anything.

The TemplateReplace command invokes a theoretical plugin called TemplateReplace. This is not part of the main bot, but a block of code that plugs into the main program. This allows the same bot to perform almost any function so long as a plugin has been written for it. This plugin would search for pages that contain all the categories in the hasCategories parameter and replace it will all the categories in the replaceWith.

Security
My first line of security is that the bot is not yet programmed to do anything, it simply reports to a log what it would have done. I call this security precaution Harmless.

Before I remove the Harmless precaution(ie before I let the bot do anything) I am going to add Recognition and warning to the list of precautions. Recognition and warning means that it will not run the commands unless the most recent person to edit the page is the bot's master. The warning part of Recognition and warning is that if someone else edits the page the bot will put a big red notice at the top so that master is sure to see the page has been edited.

I also intend to provide a password protected option. In this mode you put a password in the configuration file. When you post a script to the page the bot is watching you must take the content of that page, append it to your password, and md5sum that. Then you use that md5 sum in your edit summary. The bot will look at the page content, and your password and also calculate an md5. If the md5s match the bot knows that the person signing knows the password.

Who is the boss?
This is determined by the config file. It has the config options for all of the plugins and the CommandParser itself. The part for this bot looks like this:

'CommandParser' => {         label   => 'CommandParser', params => { controlPanel     => 'User:Chillum/Testing area', canUse           => ['Chillum','Mr.Z-man', 'Krellis','SomeWikipedian'], bosses           => { 'Chillum'      => ['Chillum'], # Only Chillum can use the account Chillum 'Mr.Z-man'     => ['Mr.Z-man'], 'DustaBot'     => ['Chillum','Mr.Z-man', 'Krellis'], # More people can command Dustabot 'FixItBot'     => ['Chillum','SomeWikipedian'], },                    },         },

This segment of the configuration file describes that 'Chillum','Mr.Z-man', 'Krellis', and 'SomeWikipedian' can give the bot commands at User:Chillum/Testing area. I, Chillum, can use the bot to edit as the accounts 'Chillum', 'DustaBot', and 'FixItBot'. Mr.Z-man can use the bot to edit as the accounts 'Mr.Z-man', and 'DustaBot', Krellis can only edit as 'DustaBot' and so on. These are account aliases, they refer to credentials stored elsewhere in the config file. Any plugin a "boss" runs can be prefixed with a UseAccount command giving an account they have access to. The plugin will be given a mediawiki editing object logged in as that user. Thus you could write one script that performs multiple accounts:


 * Go:{true}
 * UseAccount:{Chillum}
 * LogActions:{User:Chillum/unprotection log}
 * Unprotect:{!FromList|User:Chillum/Pages needing unprotection}
 * UseAccount:{DustaBot}
 * LogActions:{User:DustaBot/log}
 * ClearBlockedFromCat:{Category:Wikipedian usernames editors have expressed concern over}

This would cause the bot to use the 'Chillum' account to unprotect all the pages listed at 'User:Chillum/Pages needing unprotection', then it would use the 'DustaBot' account to remove blocked users from Category:Wikipedian usernames editors have expressed concern over.

Each command is triggered in turn and is put on hold while the next command is triggered. Plugins are programed to do small short tasks then schedule the next task for the future. A master control program rotates these scheduled tasks so that the plugins run along side each other, not one after the other.

Possible plugins
None of these are written yet, I will wait until the framework for the bot is done first.

Templates

 * SubstituteTemplate: listed templates on all pages they are transcluded on
 * TemplateReplace: Takes a list of templates and finds all pages with all the given templates. Then replaces them with all the templates in the second list
 * TemplateRename: Takes two template names, renames the first name to the second name.

Admin

 * Block
 * Unblock
 * Protect
 * Unprotect
 * Delete
 * Undelete
 * EmailDeleted: would e-mail deleted contents to a wikipedian username if they have e-mail enabled
 * UserRights
 * Rollback
 * AbuseFilterLog
 * AbuseFilter

Misc

 * Message: Takes a message or a page with a message and a list of talk pages to post that message on. This could be used to deliver the signpost for example.
 * MessageContributors: Given a page name and a message, will send a message to every user who has edited the page. Good for when an AfD goes to DRV for example.