Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =// Write your own bot scripts and functions in this file.
- // Run "Compile & Run.bat" file - it will compile this file as executable and launch it.
- using System;
- using System.IO;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Collections;
- using System.Xml;
- using DotNetWikiBot;
- class MyBot : Bot
- {
- public void addEditNotice(Page input)
- {
- input.text = "{{Wikipedia information pages talk page editnotice}}";
- input.Save();
- }
- public static void Main()
- {
- Site s = new Site("https://en.wikipedia.org", "Haven’t decided bot name yet", "no password either");
- s.defaultEditComment = "Adding editnotice";
- s.minorEditByDefault = false;
- PageList l = new PageList(s);
- l.FillFromCategory("Wikipedia information pages");
- foreach (Page p in l)
- {
- string pageTitle = p.title
- if (pageTitle.Contains("Wikipedia:")
- {
- pageTitle = pageTitle.Substring(9,pageTitle.Length);
- pageTitle = "Wikipedia talk:" + pageTitle;
- }
- else if (pageTitle.Contains("Help:")
- {
- pageTitle = pageTitle.Substring(4,pageTitle.Length);
- pageTitle = "Help talk:" + pageTitle;
- }
- else if (pageTitle.Contains("Template:")
- {
- pageTitle = pageTitle.Substring(8,pageTitle.Length);
- pageTitle = "Template talk:" + pageTitle;
- }
- string pageString = "Template:Editnotices/Page/" + pageTitle;
- Page p2 = new Page(s, pageString);
- if (p2.Exists)
- {
- if (p2.IsEmpty)
- {
- addEditNotice(p2);
- }
- else
- {
- if (p2.text != "{{Wikipedia information pages talk page editnotice}}")
- {
- addEditNotice(p2);
- }
- else
- {
- continue;
- }
- }
- }
- else
- {
- addEditNotice(p2);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment