patrolbot

command module
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 1 Imported by: 0

README

PatrolBot

codecov

PatrolBot is a Discord bot and command-line tool that assists with patrolling MediaWiki sites. It was initially built for Zelda Wiki, but it is designed to be usable by any wiki in any language.

A PatrolBot report posted in a Discord channel Using the PatrolBot CLI to patrol edits

Discord Bot

The PatrolBot Discord bot can generate reports on the state of a wiki's patrol backlog. These reports can be generated periodically or on-demand via the /report command.

Command Description
/report <type> Generate a report using data from one or more MediaWiki Action API queries.

CLI

The PatrolBot CLI (command line interface) helps patrollers work through the wiki's backlog via keyboard interface. It is particularly well suited to patrolling large quantities of smaller edits by a particular user (i.e. maintenance tasks) in rapid succession. It can also be helpful for patrolling revisions that are difficult or impossible to access via Special:RecentChanges, such as deleted files and old revisions hidden by the link limit.

Getting started

To install and run the PatrolBot CLI:

  1. Install Go

  2. Install PatrolBot:

go install github.com/iocalebs/patrolbot@latest
  1. Initialize PatrolBot configuration:
patrolbot init
  1. Start patrolling:
patrolbot patrol

Run patrolbot --help for more information on available CLI commands.

Configuration

If you wish to customize PatrolBot for your own wiki's purposes, note that the bot uses config.yaml and templates to determine what reports are available, how they're worded, and what API queries they use.

  • See Config type documentation details on supported configuration properties
  • See ReportData type documentation for details on the data available in report templates.
  • See text/template for general information on the Go template syntax used for PatrolBot reports.

A JSON Schema is available for validation and editor autocompletion of config.yaml.

Documentation

Overview

PatrolBot assists with patrolling MediaWiki sites.

Directories

Path Synopsis
internal
cli
Package cli implements the patrolbot CLI.
Package cli implements the patrolbot CLI.
cli/commands/config
Package config implements the "patrolbot config" command
Package config implements the "patrolbot config" command
cli/commands/config/view
Package view implements the "patrolbot config view" command
Package view implements the "patrolbot config view" command
cli/commands/init
Package init implements the "patrolbot init" command
Package init implements the "patrolbot init" command
cli/commands/patrol
Package patrol implements the "patrolbot patrol" command
Package patrol implements the "patrolbot patrol" command
cli/commands/register
Package register implements the "patrolbot register" command
Package register implements the "patrolbot register" command
cli/commands/report
Package report implements the "patrolbot report" command
Package report implements the "patrolbot report" command
cli/commands/serve
Package serve implements the "patrolbot serve" command
Package serve implements the "patrolbot serve" command
clock
Package clock provides an interface around the standard library's time package so that unit tests can inject a mock clock.
Package clock provides an interface around the standard library's time package so that unit tests can inject a mock clock.
config
Package config provides functionality to load config from YAML files, environment variables, and command-line arguments.
Package config provides functionality to load config from YAML files, environment variables, and command-line arguments.
discord
Package discord provides a Discord API client, as well as types and functions for receiving Interactions via HTTP webhook
Package discord provides a Discord API client, as well as types and functions for receiving Interactions via HTTP webhook
errdefs
Package errdefs provides error types for common PatrolBot errors that warrant special handling in the CLI or bot server.
Package errdefs provides error types for common PatrolBot errors that warrant special handling in the CLI or bot server.
gcp
Package gcp provides utilties for running PatrolBot on Google Cloud Platform.
Package gcp provides utilties for running PatrolBot on Google Cloud Platform.
interactions
Package interactions provides the functionality for handling Discord interactions.
Package interactions provides the functionality for handling Discord interactions.
mediawiki
Package mediawiki provides a client for interacting with the MediaWiki Action API.
Package mediawiki provides a client for interacting with the MediaWiki Action API.
patroller
Package patroller provides functionality for iterating through unpatrolled revisions in a MediaWiki backlog.
Package patroller provides functionality for iterating through unpatrolled revisions in a MediaWiki backlog.
report/data
Package data exports the type of the ReportData object in PatrolBot report templates.
Package data exports the type of the ReportData object in PatrolBot report templates.
report/provider
Package provider sources report data from the MediaWiki [Action API].
Package provider sources report data from the MediaWiki [Action API].
report/reporter
Package reporter provides functionality for generating reports with data sourced from the MediaWiki [Action API].
Package reporter provides functionality for generating reports with data sourced from the MediaWiki [Action API].
server
Package server implements the HTTP server for handling Discord interactions via webhooks.
Package server implements the HTTP server for handling Discord interactions via webhooks.
testscriptutil/discordsign
Package discordsign provides funcionality for generating request signature headers in testscript tests to simulate Discord interaction webhook requests.
Package discordsign provides funcionality for generating request signature headers in testscript tests to simulate Discord interaction webhook requests.
testscriptutil/httpstub
Package httpstub provides functionality for stubbing an HTTP server and spying on requests in testscript tests.
Package httpstub provides functionality for stubbing an HTTP server and spying on requests in testscript tests.
tools/genschema command
Genschema generates a JSON schema for PatrolBot config.
Genschema generates a JSON schema for PatrolBot config.
tools/gentestdata command
Gentestdata generates real MediaWiki Action API responses, which can then be used to mock the API in tests
Gentestdata generates real MediaWiki Action API responses, which can then be used to mock the API in tests

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL