Countervandalism Network/Bots/pgkbot

pgkbot was an IRC recent changes bot developed by pgk in python, and was the primary such bot in use for several years. It was designed for use in one channel, and included a number of customization options such as plugin support, complex event routers, individual lists, individual user name and article title watchlists, detection of page move vandalism, and IP address categories (like open proxies). However, configuration is difficult, it is relatively resource-intensive, the package has not been maintained for several years; it is no longer widely used.

pgkbot edit

Common bots: ErosionBot-1, MiszaBot, TheDJBot, ClueBot(RC).

Operation edit

Using commands edit

Commands are issued to the bot by appending their name or "computer" to the beginning of the line. If you append the name, the command will only be recognized by the bot named. If you append "computer", all bots present will recognize the command. For example, if you want to add a user to pgkbot's blacklist, you would say pgkbot bl add username. Alternately, you could add the user to the blacklist of every bot in the channel. This is recommended, as it synchronises the backup bots. To do this, you would say computer bl add username.

Which commands a user can issue depends on which list they are in.

Level Users List of commands
Information Any user intelligence commands; help.
Operation Voiced users watchlist; intelligence; help, status, quiet, speak.
Restricted Channel operators all commands.

Lists of users edit

The bots maintain several lists of users, which can be reported, formatted, and treated differently from each other.

  • Admins: this is a list of admins on the project. The relevant command is computer al add|del username.
  • Whitelist: this is the list of trusted users. The relevant command is computer wl add|del username.
  • Greylist: this is a temporary blacklist which the bot automatically populates with users that have recently been reverted, or matched one of the bnu list expression. Entries can be removed from the list, but cannot be added manually.
  • Blacklist: this is a list of suspicious users. All edits by blacklisted users are reported. The relevant command is computer bl add|del username.
  • Bots: this is a list of bots on the project. The relevant command is computer bot add|del user.

Reference table edit

This table is a quick overview of commands. For additional help, address the following command to pgkbot on IRC: pgkbot help <command>. There are two optional flags which can be used with most commands. These can be used by appending them to the end of the command (expiry must be stated before the reason, if both are used).

  • "r=value" provides a reason. This is useful for other users, who may not know why something has been added to the list without.
  • "x=value" provides an expiry time in hours. After the specified number of hours, the command will be automatically undone.

Note that the symbols "[|]" are used in the table; these symbols should not be used with the bot (for example, use "pgk add blah" and not "pgk [add] blah"). Multiple possible actions are denoted as [option 1|option 2]; only one can be used at a time. Values are designated as <value>; all strings accept regex.

Restricted bot commands edit
Command Usage Description
aclo computer aclo [add|del] IRC_name Add or remove users who can give restricted bot commands.
config (set) computer config <option> <newvalue> Modifies the configuration values. See in-depth documentation below.
config (list) computer config list List current settings
config (get) computer config [getadmins|getbots] Retrieve the list of admins or bots direct from the wiki being monitored
config (read) computer config [readmsgs|readcmds] Reread some configuration files.
dest (set) computer dest [add|del] #<channel name> grey Configure the events to report to the channel.
dest (swap) computer dest swap #<channel name> #<second channel name> Switch the events reported between two channels, useful for changing to preset settings.
reader computer reader reset Reset the connection to the recent changes channel (if the bot stops reporting).
Bot- and channel-related commands edit
Command Usage Description
help computer help <command> Provides detailed help on a command. If a command is not specified, it will provide a link to this page.
status computer status Provides basic status information about the bot, such as whether it is reporting and connected to the RC feed.
stats computer stats Miscellaneous channel statistics.
quiet computer quiet Stop reporting event to the channel.
speak computer speak Report events to the channel.
acl computer acl [add|del|show] <IRC_name> A list of trusted IRC users. These users can issue operation commands to the bot.
Watchlist commands edit
Command Usage Description
bl computer bl [add|del|show] <IP or username> A list of distrusted or vandal users.
wl computer wl [add|del|show] <username> A list of trusted users.
gl computer gl [del|show] <username> A list of possible distrusted or vandal users.
al computer al [add|del|show] <username> A list of administrators.
bot computer bot [add|del|show] <username> A list of bots.
bnu computer bnu [add|del|show] <string> Report all new usernames containing the string.
bna computer bna [add|del|show] <string> Report all new articles created containing the string.
cvp computer cvp [add|del|show] <string> Report all edits to a given article.
cnvp computer cnvp [add|del|show] <article name> A list of articles to be ignored.
cvi computer cvi [add|del|show] <image name>.<extension> Report all uploads to a particular image name.
wheels computer wheels [add|del|show] <string> Report pages renamed to a title containing the string.
Intelligence commands edit
Command Usage Description
intel computer intel <IP or username> Queries information about an IP or username.
aintel computer aintel <article name> Queries information about an article.
iintel computer iintel <image name>.<extension> Queries information about an image.

Configuration edit

Settings edit

These settings affect the way the bot filters the raw recent changes to the reported events. They are viewed with the command computer config list and modified with the command computer config <option> <new value>.

Content edit
option Description
editbig Possible nonsense (big addition of content)
editblank Possible blanking (big removal of content)
newbig Possible copyright violations (big new article size)
newsmall Possible vandalism or substubs (small new article size)
Users edit
option Description
blockconflict The number of simultaneous blocks to a single user to report.
glonrollback The number of minutes to add a user to the greylist if their edits are rolled back by an administrator.
flagnewuser The number of hours to add new users to the greylist.
glonbnu The number of minutes to add new users that match a string on the bnu list.
Other edit
option Description
pseudonym Alternate name a bot should respond to as well as its name. This should be "computer" in Countervandalism network channels.
startupquiet Don't report events on startup (toggle, "yes" or "no")
bnubnasame Synchronise the Bad new username and Bad new article name lists.

Event report toggles edit

These options toggle which events are reported to the channel. They are accessed with the command computer dest list and computer dest [add|del] #<channel name> <event>. The events are listed below. Each event will only be reported to a channel once, irrespective of fitting into several of these categories.

"Actions" in the tables below refer to all visible changes to the database, including edits, page moves, and deletions.

Users edit
Event Description
-admin Don't report actions by administrators.
-white Don't report actions by whitelisted users.
-bot Don't report actions by bots.
black Report all actions by blacklisted users.
grey Report all actions by greylisted users.
newuser Report the creation of all new users.
ip Report all edits by anonymous users.
iptmp Report all edits of templates by non logged in users
ipcat Report all edits of categories by non logged in user
Strings and regex edit
Event Description
wwuser Report new usernames matching an entry in the bnu list.
wheeler Report page moves to titles matching an entry in the wheel list.
bna Report creates of articles which match an entry in the bna list.
cvp Report edits to pages on the cvp list.
cvi Report uploads of images on the cvi list.
Actions edit
Event Description
block Report blocks.
unblock Report unblocks.
delete Report page deletions.
move Report page moves.
protect Report non userspace page protections/unprotections.
upload Report file uploads.
Content edit
Event Description
bigremove Report possible blanking (removal of content exceeding config bigremove).
bigedit Report possible gibberish (addition of content exceeding config bigedit).
bignew Report possible copyright violation (creation of a page whose size exceeds config bignew).
tinynew Report possible nonsense (creation of a page whose size is smaller than config tinynew).
Bot commands edit
Event Description
cmdsq Listen for commands in this channel, but don't respond unless addressed by nickname rather than "computer".
cmds listen for commands in this channel, and respond.

Installation edit

Pre-requisites edit

  • Python: The bot requires the python environment to run, which is freely available from the python.org download page. It is recommended that you install for all users to C:\Python with all options enabled.
  • Twisted: Also required is the Twisted python library, available from the official website.
  • Note - Pgkbot can only work with Python version 2.4 or 2.5 and will not work with older versions.

Download edit

  1. Download the latest public version of pgkbot (1.7).
  2. Unzip it to C:\pgkbot.

Configure edit

There are a few text files that need to be edited before use.

C:\pgkbot\Config\IRCConsole.conf
Field Value Notes
server irc.freenode.net This is the IRC server the bot will connect to.
port 6667 The server port to connect to; this value should be fine.
nick botnick Change this to the nickname of the bot you want to use. Do not use "pgkbot" or "computer".
password password The password to use when identifying. Comment out this line if not using Nickserv
owner yournick Change to your nickname. This gives you full access to the interface.
C:\pgkbot\Config\RCReader.conf
Field Value Notes
server irc.wikimedia.org This is the IRC server the bot will connect to to get the RC feed.
port 6667 The server port to connect to; this value should be fine.
nick yournick Change to your nickname. This gives you full access to the interface.
C:\pgkbot\Config\en\StaticConfig
Field Value Notes
controlchannel #pgktesting The channel the bot will report to.
rcsourcechannel #en.wikipedia The channel with the raw RC feed (see IRC channels).

Run the bot edit

  1. Open a DOS prompt.
  2. Navigate to the directory pgkbot is installed in.
  3. Type in c:\python24\python.exe CVUBot.py en.
  4. pgkbot will be silent upon connecting. Be sure to make it speak and route some events (see above).