User:Thurallor-bot

From Lotro-Wiki.com
Jump to navigation Jump to search

Description

This bot account has been disabled as the user owning the bot is no longer contributing to the wiki.
This is a bot account owned by Thurallor.

Projects

Here is a list of the pages that I maintain with this bot:

Generated with generate_vxp_quest_index.py
Generated with generate_vxp_deed_index.py

Here are the major batch-editing operations I've done with this bot:

  • Updated all pages that reference the Deed template, replacing some outdated parameters (Virtue, Virtue-value, Virtue2, Virtue2-value) with a new one (VXP-reward)
Performed with update_vxp_deeds.py

Setup

Here are the steps I took to create this bot (on my Windows 10 setup):

Account setup

  1. Created this Thurallor-bot account.
  2. Got a Bureaucrat to give the account "bot memberships".

Installing Pywikibot

  1. Installed Python 3.8 using the Microsoft Store.
  2. Opened a Windows command prompt. (Press Windows+R and enter 'cmd'.)
  3. Upgraded the 'pip' package:
    > pip install --upgrade pip
  4. Downloaded the latest stable version of Pywikibot:
    https://pywikibot.toolforge.org/core_stable.zip
  5. Unzipped it into a new directory.
  6. For convenience, defined an environment variable pointing to that location:
    Windows +R, type "SystemPropertiesAdvanced"
    Click "Environment Variables..."
    Add a variable called PYWIKIBOT with the pywikibot root directory in it.
  7. Opened cmd.exe, navigated to the pywikibot directory:
    > cd %PYWIKIBOT%
  8. Created a "family file":
    > python pwb.py generate_family_file https://lotro-wiki.com lotrowiki
    Do you want to generate interwiki links? This might take a long time. ([y]es/[N]o/[e]dit)n
  9. Created a user_config.py file:
    > python pwb.py generate_user_files
    family = lotrowiki
    language = en
    username = Thurallor-bot
    add any other projects = n
    add a BotPassword = n
  10. Logged in:
    > python pwb.py login
    WARNING: No user is logged in on site lotrowiki:en
    Password for user Thurallor-bot on lotrowiki:en (no characters will be shown):
    Logging in to lotrowiki:en as Thurallor-bot
    Logged in on lotrowiki:en as Thurallor-bot.
  11. Verified that I can run a script:
    > python pwb.py listpages -cat:Cosmetic_Pets

Installing Python Libraries

> pip install mwparserfromhell

Running Scripts

To run a script, you simply need to save it in your %PYWIKIBOT%/scripts/userscripts directory, and start the bot using a command such as:

> cd %PYWIKIBOT%
> python pwb.py script-name

Optionally, you may save the output into a text file (to be pasted into the wiki):

> python pwb.py script-name > output.txt

Scripts

Here are the scripts I have created for this bot.

None of these directly modify the wiki; I just save the output into a text file and manually paste that into the wiki:

Generates a table of quests that award VXP
> python pwb.py generate_vxp_quest_index > output.txt
Generates a table of quests that award VXP
> python pwb.py generate_vxp_deed_index > output.txt
Finds all deeds that use a multi-line value for the 'Extra' parameter in the deed template
> python pwb.py find_deed_extra_multiline > output.txt
Finds all pages with a certain template, and generates an XML file with the templates parsed
> python pwb.py template_to_xml

These directly modify the wiki:

In {{Deed}} templates, replace some outdated parameters (Virtue, Virtue-value, Virtue2, Virtue2-value) with a new one (VXP-reward)
> python pwb.py update_vxp_deeds

References

Installation

User:Magill-bot
https://www.mediawiki.org/wiki/Manual:Pywikibot/Installation
https://www.mediawiki.org/wiki/Manual:Pywikibot/Scripts

Writing Scripts

https://www.mediawiki.org/wiki/Manual:Pywikibot/Create_your_own_script
https://docs.python.org/3.8/
https://www.wikidata.org/wiki/Wikidata:Pywikibot_-_Python_3_Tutorial
https://doc.wikimedia.org/pywikibot/stable/api_ref/index.html