User:PxBot II/source

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);
            }
    }
}

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.