User:PxBot II/source
Appearance
using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Xml;
using System.Diagnostics;
using System.Threading;
using DotNetWikiBot;
class MyBot : Bot
{
/// The entry point function. Start coding here.
static Site enWP = new Site("http://en.wikipedia.org/", "USERNAMEHERE", "PASSWORDHERE");
public static void Main()
{
PageList pl = new PageList(enWP);
PageList plSave = new PageList(enWP);
pl.FillFromCategory("pxmatest");
pl.LoadEx();
pl.FilterNamespaces(new int[] { 1 });
pl.LoadEx();
pl.FillFromPageLinks("User:PxBot II/optin");
pl.Remove("Fuck");
pl.Remove("Shit");
pl.Remove("Bitch");
pl.Remove("Cunt");
foreach (Page i in pl)
if ((i.text.Trim() == "") || (i.text.Contains("bad faith edit"))
|| (i.text.Contains("BADWORDHERE")) || (i.text.Contains("ANOTHERBADWORD"))
||!((System.Text.ASCIIEncoding.Unicode.GetByteCount(i.text) < 2000)))
{
plSave.Add(i);
plSave.UndoLastEdits("reverting vandalism || [[user:PxBot II/Reports|Report mistake]]", true);
TellUser(i.lastUser, i.title);
}
}
private static void TellUser(string user, string title)
{
Page t = new Page(enWP, "User talk:" + user);
t.LoadEx();
// Reports to AIV
if ((t.text.Contains("19 October 2007")) || (t.text.Contains("20 October 2007")) || (t.text.Contains("18 October 2007")))
{
if ((t.text.Contains("<!-- Template:uw-vandalism4 -->")) || (t.text.Contains("<!-- Template:uw-delete4 -->"))
|| (t.text.Contains("<!-- Template:uw-spam4 -->")) || (t.text.Contains("<!-- Template:uw-speedy4 -->"))
|| (t.text.Contains("<!-- Template:uw-biog4 -->")))
{
Page p = new Page(enWP, "Wikipedia:Administrator intervention against vandalism/TB2");
p.LoadEx();
string newtext = p.text += @"
*{{IPvandal|" + user + "}} on" + title + "passed final warning ~~~~";
p.Save(newtext, "Reporting" + user, false);
}
// Gives the 4th warning
else if ((t.text.Contains("<!-- Template:uw-vandalism3 -->")) || (t.text.Contains("<!-- Template:uw-delete3 -->"))
|| (t.text.Contains("<!-- Template:uw-test3 -->")) || (t.text.Contains("<!-- Template:uw-spam3 -->")) ||
(t.text.Contains("<!-- Template:uw-speedy3 -->")) || (t.text.Contains("<!-- Template:uw-biog3 -->")))
{
t.text += @"
{{subst:user:PxBot II/Warnings/vandalism4|" + title + "}} ~~~~";
t.Save("Warning #4", false);
}
// Gives the 3rd warning
else if ((t.text.Contains("<!-- Template:uw-vandalism2 -->")) || (t.text.Contains("<!-- Template:uw-delete2 -->"))
|| (t.text.Contains("<!-- Template:uw-test2 -->")) || (t.text.Contains("<!-- Template:uw-spam2 -->")) ||
(t.text.Contains("<!-- Template:uw-speedy2 -->")) || (t.text.Contains("<!-- Template:uw-biog2 -->")))
{
t.text += @"
{{subst:User:PxBot II/Warnings/vandalism3|" + title + "}} ~~~~";
t.Save("Warning #3", false);
}
// Gives the 2nd warning
else if ((t.text.Contains("<!-- Template:uw-vandalism1 -->")) || (t.text.Contains("<!-- Template:uw-delete1 -->"))
|| (t.text.Contains("<!-- Template:uw-test1 -->")) || (t.text.Contains("<!-- Template:uw-spam1 -->")) ||
(t.text.Contains("<!-- Template:uw-speedy1 -->")) || (t.text.Contains("<!-- Template:uw-biog1 -->")))
{
t.text += @"
{{subst:User:PxBot II/Warnings/vandalism2|" + title + "}} ~~~~";
t.Save("Warning #2", false);
}
}
// Gives the 1st warning
else
{
t.text += @"
{{subst:User:PxBot II/Warnings/vandalism1|" + title + "}} ~~~~";
t.Save("Warning #1", false);
}
}
}