Crate mwbot

source ·
Expand description

A MediaWiki Bot framework

mwbot provides a batteries-included framework for building bots for MediaWiki wikis. The goal is to provide a high-level API on top of the mwapi and parsoid crates.


Create a mwbot.toml file with the following structure:

api_url = ""
rest_url = ""

username = "Example"
oauth2_token = "[...]"

See the documentation for how to get an OAuth 2 token. Using an owner-only consumer is the easiest way to do so.

You can alternatively use a BotPassword with:

username = "Example"
password = "[...]"

Using Bot::from_default_config() will look in the current directory for mwbot.toml before looking in the user’s config directory. A custom path can be specified by using Bot::from_config(...).


mwbot is the flagship crate of the mwbot-rs project. We’re always looking for new contributors, please reach out if you’re interested!


pub use parsoid;



API Client
Main bot class
Build a mwbot::Bot instance programmatically
A Page represents a wiki page on a specific wiki (Bot). You can get metadata about a page, its contents (in HTML or wikitext) and edit the page.
Extra options for saving pages


Error class for config and setup
Primary error class


Setup logging, can be adjusted by setting the RUST_LOG environment variable.

Type Definitions