patrolbot

command module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: MIT Imports: 1 Imported by: 0

README

PatrolBot

codecov

PatrolBot is a Discord bot that generates reports regarding a MediaWiki site's patrol logs.

It was initially built for Zelda Wiki but is designed to be usable by any wiki in any language.

Screenshot of a PatrolBot report posted in a Discord channel

Discord Commands

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

PatrolBot CLI

To install and run PatrolBot locally:

  1. Install Go

  2. Install PatrolBot:

go install github.com/iocalebs/patrolbot@latest
  1. Initialize PatrolBot templates and configuration:
patrolbot init
  1. Generate a report:
patrolbot report expiring

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

Configuration

The bot server uses the config.yaml and templates in the project root to determine what report types are available, how they're worded, and what API queries they use.

When running PatrolBot locally, you can customize reports by editing the config.yaml file and/or templates in $HOME/.patrolbot created by patrolbot init.

  • 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/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.
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