daily pastebin goal
51%
SHARE
TWEET

bot code

a guest Jan 31st, 2017 152 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. =// Write your own bot scripts and functions in this file.
  2. // Run "Compile & Run.bat" file - it will compile this file as executable and launch it.
  3.  
  4. using System;
  5. using System.IO;
  6. using System.Text;
  7. using System.Text.RegularExpressions;
  8. using System.Collections;
  9. using System.Xml;
  10. using DotNetWikiBot;
  11.  
  12. class MyBot : Bot
  13. {
  14.     public void addEditNotice(Page input)
  15.     {
  16.         input.text = "{{Wikipedia information pages talk page editnotice}}";
  17.         input.Save();
  18.     }
  19.  
  20.     public static void Main()
  21.     {
  22.         Site s = new Site("https://en.wikipedia.org", "Haven’t decided bot name yet", "no password either");
  23.         s.defaultEditComment = "Adding editnotice";
  24.         s.minorEditByDefault = false;
  25.         PageList l = new PageList(s);
  26.         l.FillFromCategory("Wikipedia information pages");
  27.         foreach (Page p in l)
  28.         {
  29.             string pageTitle = p.title
  30.             if (pageTitle.Contains("Wikipedia:")
  31.             {
  32.                 pageTitle = pageTitle.Substring(9,pageTitle.Length);
  33.                 pageTitle = "Wikipedia talk:" + pageTitle;
  34.             }
  35.             else if (pageTitle.Contains("Help:")
  36.             {
  37.                 pageTitle = pageTitle.Substring(4,pageTitle.Length);
  38.                 pageTitle = "Help talk:" + pageTitle;
  39.             }
  40.             else if (pageTitle.Contains("Template:")
  41.             {
  42.                 pageTitle = pageTitle.Substring(8,pageTitle.Length);
  43.                 pageTitle = "Template talk:" + pageTitle;
  44.             }
  45.             string pageString = "Template:Editnotices/Page/" + pageTitle;
  46.             Page p2 = new Page(s, pageString);
  47.             if (p2.Exists)
  48.             {
  49.                 if (p2.IsEmpty)
  50.                 {
  51.                     addEditNotice(p2);
  52.                 }
  53.                 else
  54.                 {
  55.                     if (p2.text != "{{Wikipedia information pages talk page editnotice}}")
  56.                     {
  57.                         addEditNotice(p2);
  58.                     }
  59.                     else
  60.                     {
  61.                         continue;
  62.                     }
  63.                 }
  64.             }
  65.             else
  66.             {
  67.                 addEditNotice(p2);
  68.             }
  69.         }
  70.     }
  71. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top