User:MusikBot/PermClerk

{{User:MusikBot/task|Bot clerking at requests for permissions.|{{pb}} {{User:MusikBot/PermClerk/Report}}
 * Human-readable report

Archiving
All requests are archived at Requests for permissions/Archive as approved or denied. This is done as a historical reference, namely so that admins can review previously declined requests.

N hours after the last comment was made on a request (as specified in the config), the discussion is removed from that page and an entry containing a PermaLink to the discussion is added to the archives, noting the user and the permission.

User:MusikBot/override can be used to override any other done or not done templates, and make the bot ignore the user's rights. For example, you may use ✅ when a user has requested revocation of a user right (marking as done and forcing to archive as done).

You can also force immediate archiving of a request with ~

Autoformat
Removes extraneous headers and repairs malformed requests. This functionality is not configurable, but it can be turned off entirely.

Admin backlog
Updates WP:PERM/Backlog based on configurable conditions. At the time of writing, this is set to 3+ requests or any request over 7 days old.

Autorespond
Marks requests as already done if the user already has the permission they are requesting. Only runs on WP:PERM/C and WP:PERM/AWB. For other PERM pages, the bot will wait N hours after the request (see config) has been made before concluding the admin forgot to mark the request as done.

Fetch declined
Searches the declined archives and comments if the user has had any relevant requests recently declined, with permalinks to the relevant page. Does not run on WP:PERM/C. The number of days back the bot should search is configurable.

Prerequisites
Comments if the user does not meet the configurable qualifications for that permission. The data is kept up-to-date until the request is responded to.

If the user does not meet one of the prerequisites, the bot will comment with the relevant data. For instance, if 200 mainspace edits are required, the bot will comment "this user has made X edits to the mainspace". If multiple requirements are not met, a single humanized sentence is constructed, as opposed to making multiple comments.

These prerequisites do not necessarily represent a hard requirement, and the comments made by the bot are purely for convenience.

Check revoked
Comments if the user has had the requested permission revoked in the past N days, as specified in the config. }}

Adding a new permission
The bot should now process the new page as configured. For reference, see this example of adding the New page reviewer permission.
 * 1) Create a subpage for the permission at WP:PERM
 * 2) In the pages hash add a new key/value pair for the new permission. The key is the subpage at WP:PERM and the value is the name of the user group as specified in the Wikipedia config.
 * 3) Configure prerequisites for the permission in the prerequisites_config hash (see below).

Options
The documentation for each configuration hash is as follows:

run
Specifies which PermClerk tasks the bot should run

pages
Specifies which pages the bot should process, and the regular expression the bot should use in detecting if a user has that right.

The keys should be the name of the subpage of Requests for permissions. The values are the name of the user group as specified by the wiki configuration (e.g. rollbacker, not rollback). A full list of the user groups can be found here, where the value for name is what should be used. The value for "confirmed" is actually a regular expression, since both confirmed and autoconfirmed are considered to be the same permission at WP:PERM.

adminbacklog_config
Define what the bot should consider a backlog.
 * requests is the number of open requests
 * offset is the number of days a request has been open

archive_config

 * offset is the number of hours to leave a request open before archiving
 * done is the regular expression used to identify that a request has been marked as "done"
 * notdone is the regular expression used to identify that a request has been marked as "not done"

autorespond

 * offset represents a number of hours the bot will wait before assuming the admin who granted the right forgot to mark it as "done"

fetchdeclined_config

 * offset specifies the number of days back the bot should search the declined archives

checkrevoked_config

 * offset specifies the number of days back the bot should check the user's user rights log.

prerequisites_config
These prerequisites do not necessarily represent consensus. Any changes should first be discussed at WT:PERM or another appropriate venue.

All values are integers, representing a minimum threshold the user should meet.

''If a new permission has been created, it will need to be specified here. If there are no requirements for a particular permission, simply leave an empty object as with'' {}