RationalWiki's 2018 Fundraiser

There is no RationalWiki without you. We are a small non-profit with no staff — we are hundreds of volunteers who document pseudoscience and crankery around the world every day. We will never allow ads because we must remain independent. We cannot rely on big donors with corresponding big agendas. We are not the largest website around, but we believe we play an important role in defending truth and objectivity.

If everyone seeing this today donates $5, we will meet our goal for 2018.

Fighting pseudoscience isn't free.
We are 100% user-supported! Help and donate $5, $20 or whatever you can today with PayPal Logo.png!

Donations so far: $2397Goal: $5000

RationalWiki:Bots

From RationalWiki
Jump to: navigation, search
Shortcut:

Bots (short for "robots") are (usually small) computer programs/scripts created to perform repetitive tasks or to ease routine maintenance of a website.

On wikis Bot is a class of user which is usually such a program, although some users have Bot alteregos so that repetitive tasks won't clog up Special:RecentChanges.

A current list of RW's bots can be found here (there are 47). Any of these which are generally applicable should have usage instructions on their user page.

Active bots[edit]

Archivist[edit]

Archives talkpages. See userpage for full instructions and details -- including how to run it, if FuzzyCatPotato ever disappears.

Old bots[edit]

How to make your own[edit]

You can talk to the API at http://rationalwiki.org/w/api.php. See the MediaWiki help pages.

Pywikibot[edit]

It's probably easiest to use a framework like Pywikibot. You want to use the new "core" version, not the old "compat".

Getting started[edit]

Follow the installation instructions to install Pywikibot & dependencies (note: some systems also have packages for Pywikibot: [1] [2]).

Now create the rationalwiki family; this will tell Pywikibot how to interact with the RationalWiki API:

python3.4 generate_family_file.py http://rationalwiki.org/wiki/Main_Page rationalwiki

will give you a family file in pywikibot/families/rationalwiki_family.py. The default will do fine for most cases.

You'll need to edit the user-config.py:

mylang = 'en'
family = 'rationalwiki'
usernames['rationalwiki']['en'] = 'MummificationBot'

Finally, test your setup with python pwb.py login, which should prompt for the login password for your bot, and then output Logged in on somewiki:lang as bot username. The password should be remembered.

Multiple accounts[edit]

Pywikibot only supports a single account name; for separate accounts you could use something along the lines of this in your user-config.py:

import os, sys

mylang = 'en'
family = 'rationalwiki'
user = os.getenv('RW_USER')
valid = {
    'MummificationBot': 'store password here if you want',
    'RedirectBot': 'store password here if you want',
}

if user not in valid.keys():
    print('No such user; valid users: {}'.format(valid.keys()))
    sys.exit(1)

print(user)
usernames['rationalwiki']['en'] = user

del user
del valid

Now just set the RW_USER environment variable before running the script:

RW_USER=MummificationBot python pwb.py login

An alternative is using separate Pywikibot directories (this is the documented way, but a bit silly).