From Wikinews, the free news source you can write!
Jump to navigation Jump to search

I've started development on a framework for MediaWiki bots. I refuse to accept that the existing Interwiki bot framework in python is as good as it can get, so I'm trying to write an easy to understand, extensible bot framework in .NET.

The primary goal is to be able to receive images from the Wikinews:WeatherChecker process and to be able to auto-upload them and update the relevant pages to relink to the new images.

Current development[edit]

The state of development is outlined for those interested. The application has been released under the GPL and is available at


  • bot framework started
  • login and edit-page fetch is working
  • request throttling in place
    • wikinews has no policy on bots.
  • ability to save pages
  • ability upload images
  • support for XML config files (not like the one below, but similar)
  • fully automated test on Commons image upload, Wikinews file editing. Please see page listed under "current development" for CVS etc info.

Future work[edit]

  • more commands
  • better global / local variable separation
  • rate limiting fix
  • better international support
  • complileable framework for command extensions kind of like the data below
<bot wiki="$$wikisite">
	<command name="Login">
		<param name="username" value="$$username" />
		<param name="password" value="$$password" />
	<command name="GeneratePageList">
		<output value="$pagelist" />
		<param name="startDate" value="January 12, 2005"/>
		<param name="endDate" value="January 31, 2005" />
			<references lib="System" />
			<code classname="DateTimeRangePageListDataProvider">
				public class DateTimeRangePageListDataProvider : PageListDataProvider
					DateTime _current;
					DateTime _last;

					public GeneratePageListDataProvider(CommandParams parameters) 
						_current = DateTime.Parse(parameters["startDate"].ToString());
						_last = DateTime.Parse(parameters["endDate"].ToString());

					public override bool GetPage(out string pageName)
						DateTime toReturn = _current;

						pageName = _current.ToString("MMMM d, yyyy");

						return _current <= _last;
	<command name="ProcessPageList">
		<param name="source" value="$pagelist" />
			<references lib="System" />
			<references lib="System.Text" />
			<references lib="System.Text.RegularExpressions" />
			<code classname="AddDateTemplatePageProcessor">
				public class AddDateTemplatePageProcessor : PageProcessor
					PageList _pageList;
					public AddDateTemplatePageProcessor(CommandParams parameters)
						_pageList = parameters["source"] as PageList;
					public override void Process(WikiPage page)
						//code to look for {{datecategory|date-for-this-page-title... in the page wikitext
						//if not found, code to insert before everything else {{datecategory|blah...}}
  • implement snippet compilation for command plugins