User:HermesBot~enwikinews/source

From Wikinews, the free news source you can write!
Jump to navigation Jump to search
using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Xml;
using DotNetWikiBot;
using System.Threading;
class MyBot : Bot
{
    public static void Main()
    {
        TextReader reader = new StreamReader("signpost.txt"); //this file needs to be in the executing directory.
        string toappend = "\r\n" + reader.ReadToEnd();
        Site enWP = new Site("http://en.wikinews.org", "HermesBot", "PASSWORD GOES HERE");
        Page p = new Page(enWP, "user:HermesBot/signpost");
        p.LoadEx();
        string newtext = p.text + "\r\n" + reader.ReadToEnd();
        string[] linkArray = p.GetAllLinks();
        foreach (string s in linkArray)
        {
            Page p1 = new Page(enWP, s);
            p1.LoadEx();
            string newtext1 = p1.text + toappend;
            p1.Save(newtext1, "[[w:WP:SIGNPOST|Signpost]] deliverly", false);
            Thread.Sleep(10000);
        }

        p.Save(newtext, "[[w:WP:SIGNPOST|Signpost]] deliverly", false);
        Thread.Sleep(10000);
    }
}