Hoppa till innehållet

Wikipedia:Projekt DotNetWikiBot Framework/GameOnBot/Syntaxfel/048 - Ownlink

Från Wikipedia
//Originally made by sv:Användare:GameOn in 2011
using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Xml;
using DotNetWikiBot;
using System.Threading;
using System.Net;
using System.Web;

class MyBot : Bot
{
	public static void Main()
	{
		Site     site                = new Site(wiki, username, password);
		String   editCommentStr      = "Syntax error 048: Link goes to article";
		String   orgStr;
		PageList pl                  = new PageList(site);

		pl.FillFromFile("test1.txt");
		pl.FilterNamespaces(new int[] {0});
		foreach(Page myPage in pl)
		{
			myPage.Load();
			orgStr = myPage.text;
			myPage.text = myPage.text.Replace("[[" + myPage.title + "]]", myPage.title);
			if(myPage.text != orgStr)
			{
				myPage.Save(myPage.text, editCommentStr, true);
				Thread.Sleep(60000);
			}
		}
	}
}