Gamepedia Help Wiki
Register
Advertisement
Robot

Bots (short for robots) are external tools that access the wiki in any manner other than the usual web interface. MediaWiki has an application programming interface (API) for this purpose. This API is a protocol external tools can use to request data from a MediaWiki wiki or perform changes to it.

The term "bot" is somewhat confusing. It may refer to anything that accesses the API, from advanced global find-and-replace tools (such as AutoWikiBrowser, known as AWB) to frameworks that let users perform a broad variety of automated tasks (such as Pywikibot, known as PWB). AWB and PWB, mentioned above, are the most popular tools referred to as "bots". If you wish to use either (or both), visit the respective pages for details.

Most regular users shouldn't need to run bots. Moreover, running a bot may require programming knowledge. Automated changes to wikis should be coordinated with local admins or other staff.

Best practices

These practices are courteous to your fellow wiki editors and allow the bot operator to more easily track down and fix any errors made by their bot.

Bot user accounts

If you intend to automate a lot of changes, you should create a separate bot account. It's a good idea to name it so it's clear it's a bot, and that it's your bot. The easiest way to do so is to take your username and append "Bot" for the name of the bot account.

If you want to run a bot on a wiki, you should notify your wiki manager (or a bureaucrat, if there is one). They can add your bot to the bot user group.

Having a separate bot account is helpful for a few reasons. First, it lets the bot operator more easily recognize and revert their bot's edits if needed, without accidentally reverting any edits made by their primary account. Bot accounts can also be added to the bot user group. By default, API edits by bot users are hidden in recent changes, which reduces clutter on that page. Users can toggle showing bot edits in RC with the "Show/hide bots" option or the equivalent filter in the new RC interface. If recent changes are showing edits by bot accounts, any such edits will be marked with b, like minor edits are marked with m.

Edit summaries

Bots should be configured to leave summaries for the actions they perform. For example, the summary could say, "Replaced Template:Old with Template:New", or "Trimming trailing whitespace". Summaries generally help users see at a glance what changes are being made to pages, and for bot edits, summaries also help track down and revert errors.

Choosing between AutoWikiBrowser (AWB) or Pywikibot (PWB)

When getting started with automation, one of the first decisions you must make is which bot tool to use. For most users, the choice is between AutoWikiBrowser (AWB), and Pywikibot (PWB). While many people use both, depending on the task, each tool has its pros and cons.

AWB

Pros:

  • Has a GUI instead of requiring to do everything through a command-line interface.
  • Easier setup & lower barrier to entry as a result.
  • Better at doing complex find-and-replace operations.

Cons:

  • Limited selection of generators, so editing lists of pages with complex criteria sometimes requires several steps.
  • AWB only has Windows executables, and needs Wine to run on Mac and Linux.

PWB

Pros:

  • Can delete, move, and create pages easily instead of just editing.
  • Once you are familiar with the command line interface & available options, it's fewer clicks to accomplish some of the tasks that both tools can do.
  • Can use a wider variety of page list generators.
  • Can be run on most operating systems without requiring extra tools.

Cons:

  • More difficult to set up and more difficult to learn.
  • Harder to preview changes before making them.

Custom bot development

Some advanced users choose to create their own bots and scripts to interact with the wiki. Such tools can be written in many languages, often JavaScript (to run in the browser) and Python (to work with PWB, or the mwclient and mwparserfromhell libraries). See the MediaWiki.org page on API clients for more information.

See also

Advertisement