Help:Bots

From Saintapedia
Jump to navigation Jump to search

Bots (short for "robots") are automated scripts that perform repetitive maintenance and improvement tasks on Saintapedia. They help keep the wiki accurate and consistent without requiring manual editing of hundreds or thousands of pages.

Because Saintapedia uses S Cargo drilldown for saints by country, parishes by diocese, etc., and many pages include AI-generated content (with the standing note to "verify key details"), bots can be especially useful for bulk verification, template standardization, category sorting, link fixing, and updating time-sensitive data like feast days.

Bot guidelines on Saintapedia

Saintapedia does not yet have a formal bot policy page (as of early 2026), but the following best practices are strongly recommended for any automated editing:

  • Always create a separate bot account (e.g. User:SaintapediaBot1).
  • Use a bot password (go to Special:BotPasswords after logging in as your bot account) instead of your main account password.
  • Mark every edit as a bot edit (most frameworks do this automatically when flagged).
  • Start very slowly: 5–10 edits per minute maximum to avoid overloading the server.
  • Provide clear, informative edit summaries (e.g. "Bot: Adding country category from Cargo data Special:Drilldown/Saints").
  • Run small test batches first (e.g. 10–20 pages) and review them manually.
  • Stop immediately and notify an administrator (via their talk page) if anything goes wrong or if requested.
  • Do not use bots for controversial or content-creating edits without community discussion first.
  • Avoid editing user talk pages, active discussions, or protected pages without explicit permission.

If your bot will make many edits, consider posting a short announcement on a community page (e.g. the village pump equivalent if one exists, or User talk:Tom / admin talk) so others know what is happening.

Recommended tool: Pywikibot

The best and most widely used framework for creating bots on MediaWiki wikis (including non-Wikimedia ones like Saintapedia) is Pywikibot (Python-based).

Pywikibot works perfectly on Saintapedia because:

  • It connects via the MediaWiki API (no special server access needed).
  • It supports querying Cargo tables (via semantic-like asks or list=query).
  • Ready-made scripts exist for common tasks (template replacement, category addition, text fixes).
  • It has built-in throttling and emergency stop features.

Quick installation (2026)

  1. Install Python 3.10+ (3.11 or 3.12 recommended).
  2. Install Pywikibot:
pip install --user pywikibot
  1. Or (for full scripts + development):
git clone https://github.com/wikimedia/pywikibot.git
cd pywikibot
pip install -r requirements.txt

First configuration for Saintapedia

Run any script once to generate config files:

python -m pywikibot version   # or pwb version if pip-installed

Answer:

It will create user-config.py. You can manually edit it later to add:

usernames['saintapedia'] = 'YourBotUsername'
password_file = 'user-password.py'   # or use botpassword

Useful ready-made scripts for Saintapedia

  • Replace text or templates across pages:
pwb.py replace -pt:1 "{{old infobox}}" "{{Church}}" -summary:"Bot: Updating to standard Church template"
  • Add categories from lists or queries (e.g. saints by country):
pwb.py category -from:"Category:Saints by country" -to:"Category:Saints of Europe"
  • Fix double redirects:
pwb.py redirect -fix
  • Cosmetic fixes (spacing, sorting):
pwb.py cosmetic_changes

See full list: [3]

Writing a custom bot (simple example)

Add country categories to saint pages using page titles or Cargo data:

import pywikibot
from pywikibot import pagegenerators as pg

site = pywikibot.Site('saintapedia', 'saintapedia')  # adjust family if needed
gen = pg.CategorizedPageGenerator(site, category='Category:Saints', recurse=False)

for page in gen:
    if not page.exists() or page.isRedirectPage():
        continue
    text = page.text
    if '[[Category:Saints]]' in text and '[[Category:Saints of' not in text:
        # Simple heuristic; improve with Cargo query if needed
        country = "Infer from title or data"  # replace with logic
        new_text = text + f"\n[[Category:Saints of {country}]]"
        page.text = new_text
        page.save(summary="Bot: Adding country subcategory", minor=True, botflag=True)

For Cargo integration, use pywikibot's askquery or list=query&list=cargotables.

Alternatives

  • AutoWikiBrowser (AWB) — graphical semi-automated tool (Windows-focused, but runs on Linux via Mono).
  • Simple JavaScript user scripts or gadgets for very light automation (no login needed, but limited).
  • For testing: Use PAWS (cloud Jupyter with Pywikibot) at https://paws-public.wmflabs.org — great before running live.

See also

External links