Advertisement
Guest User

new bot code

a guest
Jan 28th, 2017
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.07 KB | None | 0 0
  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 = "Template:Editnotices/Page/" + p.title;
  30.             Page p2 = new Page(s, pageTitle);
  31.             if (p2.Exists)
  32.             {
  33.                 if (p2.IsEmpty)
  34.                 {
  35.                     addEditNotice(p2);
  36.                 }
  37.                 else
  38.                 {
  39.                     continue;
  40.                 }
  41.             }
  42.             else
  43.             {
  44.                 addEditNotice(p2);
  45.             }
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement