Clone this repo:

Branches

  1. b02dff0 mediawiki: Handle date parsing failure by Taavi Väänänen · 4 weeks ago master
  2. 3cf708f Format with newest black by Taavi Väänänen · 4 weeks ago
  3. 47f6498 t5: fix array access by Taavi Väänänen · 3 months ago
  4. de91b7b t5: ignore delete log entries by Taavi Väänänen · 3 months ago
  5. acba082 task 5: week numbering sucks by Taavi Väänänen · 4 months ago

majavah-bot

This repository contains the code for User:MajavahBot, which operates on many Wikimedia wikis, including the English, Finnish Wikipedias and the Wikimedia Meta-Wiki. Its bugs are tracked on the Wikimedia Phabricator. The bot is hosted on Wikimedia Toolforge.

Running the bot

Installing

The bot uses Python 3. It is currently running 3.5 in production. Clone this repository and create a virtual environment. Use pip to install dependencies from requirements.txt.

Configuring

The bot has a configuration file majavahbot/config.py and a sample one at majavahbot/config.example.py. To get started, copy the sample file over and modify any values that need modifying. It contains two types of values:

  • Database credentials, for a local database to store own data and for a Wiki replicas connection. This includes a hostname and a port to connect (for replicas use {DB} to properly connect to the right database) and the path to a configuration file containing a username and a password (sample format is provided at local.my.cnf and Toolforge has this directly provided to you).
  • Page names for on-wiki configuration files. See https://en.wikipedia.org/wiki/User:MajavahBot/EFFP_Helper_Configuration for an example.

The CLI

The cli.py file can be used to run the bot. Use python cli.py --help to retrieve a list of all subcommands and python cli.py {subcommand} --help to get help related to that specific subcommand.

Architecture

The source code lives on majavahbot/. It is divided on three parts:

  • majavahbot/api/ contains a framework that the rest of the bot uses.
  • majavahbot/tasks/ contains the individual tasks that the bot can run.

There is also cli.py, which handles the command-line interface for running the bot.

LICENSE

majavah-bot is free software licensed under the MIT license. See LICENSE for more details.