From Dota 2 Wiki
Jump to: navigation, search

A bot is a computer program that automatically retrieves or updates wiki pages when it is executed. In general, bots are used for repetitive maintenance tasks, whose volume and characteristics are too large to be performed manually by users.

Developing and executing bots is usually outside the role of normal users, requires programming experience, and must be done in coordination with the wiki's admins or other staff.

Bot user accounts

It is recommended that users that intend to do a lot of automation using bots create a separate user account for performing bot actions. Bot accounts should recognizably indicate which user they belong to, usually by appending "bot" to the user's primary account name.

Users that wish to create a bot user account should notify a bureaucrat or Gamepedia staff on the wiki before doing so, as they can add the bot user group to the account using Special:UserRights.

Having a separate bot account is beneficial for a few reasons. First, it allows the bot operator to more easily recognize and revert their bot's edits if necessary, without accidentally reverting any of the edits made by their primary account. Additionally, bot accounts can be flagged with the bot user group. By default, edits by bot users performed with the API or a third party tool are hidden in Special:RecentChanges, which reduces clutter in the recent changes. Any edits made by an account marked with the bot user group will be marked by an lowercase letter B (b) next to their edits when viewed in Recent changes, and the visibility of these changes can be toggled using the "Show/hide bots" option.

Accessing the wiki with a bot

Bots do not access the wiki through the normal user interface. MediaWiki has an API (Application Programming Interface) available for this purpose. An API is a protocol for standardized communication between two computer programs.

Bots use several different tools and frameworks, the most popular being AutoWikiBrowser and Pywikibot. Several bot operators create their own frameworks, for fun or because of the many limitations that existing frameworks have.


Because bots do not access the wiki the same as a regular user, they also use a special authentication system. This uses a password generator to create a special login for automated tools, accessible at Special:BotPasswords on any Gamepedia wiki. For more information on using the bot password for each bot tool, see Pywikibot and AutoWikiBrowser.

This method for setting up an account to use a bot or other external editors using the API interface was implemented on Gamepedia on March 1, 2017.

AutoWikiBrowser or Pywikibot?

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, commonly abbreviated "AWB", and Pywikibot, commonly abbreviated "PWB". While many people use both, depending on the task, each tool has its pros and cons.



  • Has a GUI instead of just being done through command prompt
  • Easier setup & lower barrier to entry as a result
  • Better at doing complex find-and-replace options


  • Limited selection of generators, so editing lists of pages with complex criteria sometimes requires several steps
  • AWB is Windows-only (but can be run in Wine on Mac and Linux)



  • 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


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

Custom bot development

Some advanced users have created their own bots and scripts to edit the wiki. These can be written in several languages, some of the most commonly used being JavaScript and Python. See mw:API:Client code for more information.

See also


For all of those who are interested in using PWB. Here's a step-by-step guide:

  • Check if Python was added to your windows path. ;C:\Python3x
To permanently modify the default environment variables, click Start and search for ‘edit environment variables’, or open System properties, Advanced system settings and click the Environment Variables button. In this dialog, you can add or modify User and System variables. To change System variables, you need non-restricted access to your machine (i.e. Administrator rights).
  • From now on you need CMD, the windows command line. Install the "request" module via python install. You can change the directory with cd to go wherever you unpacked the "request"
  • Download PWB and unpack it somewhere (e.g. under C:/Programs/PWB)
  • Create an empty file called "" in C:/Programs/PWB/pywikibot/families/ and paste in the following content:
# -*- coding: utf-8 -*-

from __future__ import absolute_import, division, unicode_literals

from pywikibot import family
from import deprecated

class Family(family.Family):  # noqa: D101

    name = 'dota2'
    langs = {
        'en': '',
        'ru': '',
        'pt': '',
        'zh': '',

    def scriptpath(self, code):
        return {
            'en': '',
            'ru': '',
            'pt': '',
            'zh': '',

    def version(self, code):
        return {
            'en': '1.31.2',
            'ru': '1.31.2',
            'pt': '1.31.2',
            'zh': '1.31.2',

    def protocol(self, code):
        return {
            'en': 'https',
            'ru': 'https',
            'pt': 'https',
            'zh': 'https',
  • Run python from your PWB folder via CMD. Follow the instructions.
  • Optionally delete the two example files.
  • Open the and do some modifications: These were my modifications. Of course you are neither admin (sysop) on every page, nor do you have a need for listing all of languages. Just take what you need.
# If you use either of these functions to define the family to work on by
# default (the ‘family’ variable below), you must place the function call
# before the definition of the ‘family’ variable.
family = 'dota2'

# The language code of the site we're working on.
mylang = 'en'

# The dictionary usernames should contain a username for each site where you
# have a bot account. If you have a unique username for all languages of a
# family , you can use '*'

password_file = ""

usernames['dota2']['en'] = u'Username'
usernames['dota2']['pt'] = u'Username'
usernames['dota2']['ru'] = u'Username'
usernames['dota2']['zh'] = u'Username'
sysopnames['dota2']['en'] = u'Username'
sysopnames['dota2']['pt'] = u'Username'
sysopnames['dota2']['ru'] = u'Username'
sysopnames['dota2']['zh'] = u'Username'
  • Create a new password file called in the folder with the following content. Replace <Text> with the details you defined for the bot access:
("<Username>", BotPassword("<Botname>", "<Botpassword>"))
  • Done, you can make a checkrun with such a command. It will list all pages that contain "Slar" (e.g. Slark and Slardar):

python listpages -format:3 -titleregex:'Slar' -start:!


Grow icon.png
▶️ They call me Tiny.
This article is a stub. As such, it is not complete.
You can help Dota 2 Wiki by expanding it.


Official documentation: Read the Docs

mwclient is a more lightweight alternative to PyWikiBot. It does not come with preinstalled scripts.

  1. Download Python (any version >2.7 should work).
  2. Install mwclient by entering pip3 install mwclient (pip install mwclient if you are using Python 2.x)
  3. Create a new text file and save it with the .py extension.
  4. Write your script in the file you just created.
  5. Run it by entering python3 path/to/your/ (python path/to/your/ for Python version 2.x)


The mwclient module is based around the Site() object. This object needs to be setup at the beginning of your script:

import mwclient

site = mwclient.Site('', path='/')

To authenticate yourself you use the Site.login() method. The needed bot account can be created from Special:BotPasswords.

site.login('bot_user_name', 'bot_password')

From there you can use the the methods explained in the documentation.


import mwclient

site = mwclient.Site('', path='/')
site.login('bot_user_name', 'bot_password')

page = site.Pages['Evil Geniuses']
text = page.text()
text = text.replace('Arteezy', 'Fear'), summary='Bot: Arteezy left the team.')