Forum:Bot for creating charm drop subpages

From the RuneScape Wiki, the wiki for all things RuneScape
Jump to: navigation, search
Forums: Yew Grove > Bot for creating charm drop subpages
Archive
This page or section is an archive.
Please do not edit the contents of this page.
This thread was archived on 15 January 2010 by Calebchiam.

I propose creating a bot to create charm drop subpages for monsters. These pages would contain the data for the charm drop logs. This data is currently contained in the pages for the monster, and is nearly impossible to access from any page other than that of the monster itself.

The proposed bot would check all the pages using the Infobox Monster template in the Bestiary category. It would ensure that those pages are in the mainspace (seeing as how some editors fancy themselves level 2000 monsters). It would then attempt to find the Drops section, and look for any charms. If the monster drops any charms, it would create PAGENAME/Charms "PAGENAME/Charm log" if it does not already exist. The PAGENAME/Charms "PAGENAME/Charm log" subpage would contain a Charm data template, where the data would be saved exactly as it is now, except in a separate page. This bot would run only once.

If this idea is approved, I would be willing to write this bot in Java, based on AmauriceBot's code.

I'm a regular user and I approve this message.  TLUL Talk - Contribs 00:24, November 19, 2009 (UTC), updated 04:41, December 4, 2009 (UTC) 

Specification

Although this discussion has only been open a short time, I have not seen any resistance to making the changes proposed, nor to using a bot to do so. Therefore, I have posted the specifications for the bot in detail.

Task

The task of this bot is to create subpages named "Charm log" for every page dedicated to a monster which drops at least one type of charm. It will perform the following steps when it runs:

  1. Requests a username and password from the operator
  2. Logs in to Wikia with these credentials
  3. Accesses the Bestiary category and finds the names of every page within it
  4. Filters the names so that those containing a ":" are not included, in case of accidental category addition
  5. Accesses each page on the list in turn, and:
    1. Searches for a "Drops" section
    2. If one is found, and it contains at least one type of charm, creates a subpage called "Charm log" containing a Charm log data template
    3. If a charm log template is found on the main monster page, copies the data into the subpage template, otherwise uses zeros
    4. If an error is encountered while accessing/editing the page, notes the error in a log
  6. Saves the log to a subpage of the bot's userpage

The bot will also check the "Control" subpage of its userpage after every 10 pages it updates.

Implementation

The bot will be based on the code for AmauriceBot. The bot will contain eight Java classes: Main, TLULbotGUI, WikiSession, Utils, CharmPage, SandboxCleaner, GESession, and GEChecker. Only the first five will be used for the tasks specified (though, in theory, the bot would still be able to run any of the tasks of AmauriceBot). The bot will run only once.

The Main class will contain code for running the bot from the command line, and will be almost identical to the code of AmauriceBot, with only a few lines added to support the new tasks.

The TLULbotGUI class will provide an optional Graphical User Interface for the bot.

The WikiSession class will be unchanged from AmauriceBot, and will manage connections to this wiki, or any specified testing wiki.

The Utils class will provide utilities for the other classes, and will also remain unchanged.

The CharmPage class will run the tasks listed above, occasionally outputting its status to the command line or to the GUI, depending on which method is used to run the bot. As it runs, it will use the utilities provided by the Utils and WikiSession class to manage authorisation, accesses, and modifications to pages. These utilities access the MediaWiki API.

The SandboxCleaner, GESession, and GEChecker classes will be unused, and will remain identical to those in AmauriceBot.

Controlling the bot

After every 10 edits it makes, it will check the "Control" subpage of its userpage. If the content of this page contains the text "TLULBOT-PAUSE" it will pause and await instructions from the operator (myself). Due to the possibility of abuse of this feature, I will request that this page be semi- or fully-protected prior to operation of the bot. A link to edit this subpage will be provided on the bot's userpage, and will automatically set the text of the edit to "TLULBOT-PAUSE".

Should this modification of the subpage fail to stop operation of the bot, the next step would be to block the bot. This method is available only to administrators. A link to block the bot will also be provided on its userpage.

Please note that the bot will access the userpage of whatever user it is logged in as, not simply User:TLULbot.

Source code

I will make TLULbot's source code available after I have cleaned it up a bit. Miles of undocumented code (even if they aren't miles) are not particularly helpful. TLULbot is copyrighted under the GNU General Public License. I'm a regular user and I approve this message.  TLUL Talk - Contribs 03:06, November 21, 2009 (UTC) 

Testing