From Meta, a Wikimedia project coordination wiki
Jump to: navigation, search

wm-bot is an IRC bot that is being used in several Wikimedia IRC channels, particularly developer channels. This page documents the bot.

The bot is designed to have separate configuration for each channel, so that anyone can get it to their channel having own database. Bot is maintained by user who bring it to channel, so that anyone can configure as they want.



In case you need any help with this bot, please contact one of its operators:

Or - fill in a ticket: https://phabricator.wikimedia.org/maniphest/task/create/?projects=wm-bot&assign=Petrb

Getting bot to the channel[edit]

In case you are a wikimedia user with wikimedia cloak and you want to use this bot in a wikimedia related channel, you can just join #wm-botconnect, where you can type:

@add #nameofchannelyouwant

This make the bot join your channel and give you admin permissions for that channel.

However there may be some exceptional situations:

Bot will not join[edit]

Bot is probably banned or stuck in some way. For example if you invite a bot and then use freenode's /remove command (which isn't compliant with irc standards anyway so it makes sense the bot doesn't know it) the bot will still think it's in the channel. You can try to make it part the channel from #wm-bot by calling @part #channel

Bot will not give you admin rights[edit]

If the bot was in the channel previously and removed using @part command, it will still have the same ACL so that you won't get admin rights. Instead, the same people as before will have it. You can always contact some of bot operators to help you in this situation.

User access[edit]


Admin has access to all commands, the user who bring the bot to channel is always made admin unless the bot was previously parted (in that case the previous access list is preserved). This user level can be granted to anyone else using the @trustadd command (see below).


Trusted users have access to most of commands

If you are a trusted or admin you can use command @trustadd to insert more people to access list

User list[edit]

User list can be controlled using following commands


Display list of users for current channel

@trustadd regex level[edit]

Add regex to defined level, level being one of admin, trusted. Example:

@trustadd .*@wikipedia/John trusted

@trustdel regex[edit]

Delete regex, you can only delete trusted users

Recent changes feed for wmf wikis[edit]

wm-bot supports a relay of recent changes feed directly to any channel, below is a list of commands which you can use in order to setup the bot

Wiki codes

  • example: fr.wikipedia.org
  • meta.wikimedia.org
  • commons.wikimedia.org
  • www.wikidata.org
  • outreach.wikimedia.org
  • wikimania2012.wikimedia.org
  • wikimania2013.wikimedia.org
  • incubator.wikimedia.org


Needs admin rights, this command has no parameters

Disables a feed of recent changes of wikimedia wikis in current channel. The database of pages you configured, will be preserved.


Needs admin rights, this command has no parameters

Enables a feed of recent changes in current channel, you can select certain pages on selected wikis to be watched.

@RC- wiki page[edit]

Require trusted rights, this command has 1 parameter

Removes a page from list of recent changes, affects only current channel.

Example: @RC- en.wikipedia.org User:Test_page

@RC+ wiki page[edit]

Needs trusted rights

Insert a page to a feed, example @RC+ de.wikipedia.org User:Test_page would make it report changes to de.wikipedia.org/wiki/User:Test_page directly to channel.

Additionally, @RC+ de.wikipedia.org User:Test_page/* would make it report changes to any subpages (but not the primary page) of de.wikipedia.org/wiki/User:Test_page directly to channel. Note that the * wildcard can only be used on the end of the string.


Infobot can be controlled by trusted users using following commands:

<@petan> !key is some data
<wm-bot> Key was added!
<@petan> !key
<wm-bot> some data
<@petan> !key del
<wm-bot> Deleted key
<@petan> !key is this is $1
<wm-bot> Key was added!
<@petan> !key 1
<wm-bot> this is 1
<@petan> !google is https://www.google.com/search?q=$url_encoded_*
<wm-bot> Key was added
<@petan> !google some special symbols % 6 7#%#$%@
<wm-bot> https://www.google.com/search?q=some+special+symbols+%#25+6+7%#23%#25%#23%#24%#25%#40
<@petan> !google some special symbols % 6 7#%#$%@ | addshore
<wm-bot> addshore: https://www.google.com/search?q=some+special+symbols+%#25+6+7%#23%#25%#23%#24%#25%#40

You can create an alias by typing !key alias key2 so that !key would display value of key2.

The aliases have lower priority than keys so you can overwrite an alias with key (it's possible to create both)

Command !key unalias removes it

Variable Response
$infobot_nick Nick of user who trigger the key
$infobot_host Hostname of user who trigger the key
$1 - $9 Parameters one at a time
$* All parameters in one shot
$url_encoded_1 - $url_encoded_9 URL encoded parameters one at a time
$url_encoded_* All parameters in one shot and URL encoded
$wiki_encoded_1 - $wiki_encoded_9 Wiki encoded parameters one at a time (same as {{URLENCODE: $1 - $9|WIKI}})
$wiki_encoded_* All parameters in one shot and wiki encoded (same as {{URLENCODE: $1 - $9|WIKI}})

@regsearch <regex>[edit]

Search regular expression in all values

@search <word>[edit]

Search key names and values for given word

Private message commands[edit]

You can send a private command to wm-bot like this:

/msg wm-bot @command parameter


This command let you know when specified user becomes active or online. You can use this even on users who aren't registered on server or even on users who are online, but not active currently.

Example: @notify hashar


@seen user

Tell you when user was last seen

All labs commands[edit]

See help for @labs-*

Channel commands[edit]


Require admin rights

Insert a bot to another channel (@add #example)


Doesn't require any permission

Link to html dump of database and channel info (no parameters)



Create a table of channel use statistics to be include in the html dump accessible with @info


Stop measuring channel use statistics to be include in the html dump accessible with @info

(off by default)


For example if I was waiting for hashar, I could just send a private message

@notify hashar

to wm-bot and he would send me a private message whenever hashar appeared or spoke somewhere. It works even on users who are already online but idle – he then pings you when the user stops being idle.



Require admin rights

Turn on infobot for current channel


Require admin rights

Disable infobot on current channel


Require admin rights

Create a link to infobot db of different channel, this allows you to share infobot with other channels. If you link channel A to channel B's db, the local db of channel A will be no longer accessible, but will not be deleted. If you unlink the channel db, local db will be accessible again.

Example: @infobot-link #mediawiki will make a bot use db of #mediawiki, instead of local db.

Syntax: @infobot-link #channel


Require admin right

Enable shared infobot, this is necessary to execute on the channel you want to share the db of with other channels.


Require admin right

Remove a channel from trusted relation. This channel will no longer have access to shared db.


Require admin right

Insert a channel to db, that means this channel will be allowed to access the shared db for reading and writing.

example: @infobot-share-trust+ #test

this allows #test to link to infobot db of channel where you triggered this command and to read and write into it, based on own access list.


Require admin right

Disable shared infobot


Require trusted right

Insert a new string to ignore list of infobot, for example

@infobot-ignore+ seen

makes the bot ignore any commands !seen in a channel


Require trusted right

This command remove an ignored key from list, syntax: @infobot-ignore- <item>


Doesn't require any rights

Syntax: @infobot-detail <key>

Display information about key


Require trusted right

Make the key "raw" that means, all special words, $1, $2... will be displayed as they are, instead of converting to specific values, the | symbol is ignored in such a key. Only special word that is respected is $url_encoded_* and $*


Require trusted right

Syntax: @infobot-unset-raw <key>

This command undo the @infobot-set-raw


Require admin right

example: @infobot-recovery previousdb

Recovers a snapshot - be careful as this operation removes the current database without asking, it's useful to create a snapshot before recovering some other so that you can restore the current db in case something go wrong.


Require admin right

example: @infobot-snapshot previousdb

Creates a snapshot of current db, it is a bit clone of a database that can be restored anytime to its current status.


Require admin right

example: @infobot-snapshot-rm previousdb

Removes a snapshot


List all snapshots for current channel



Requires trusted right

Tell you when user matching regex was last seen

Example: @seenrx ^[Pp]etan$


Tell you when the specified user was last seen, case insensitive and doesn't support wild cards.

Example: @seen petan


Require admin right

Turn on the seen for the current channel


Require admin right

Turn off the seen for the current channel

rss feed[edit]


Require trusted right

Insert a new item, syntax: @rss+ <name> <url>

example: @rss+ bbc http://bbc.co.uk/rss.xml


Require trusted right

Remove an item

syntax: @rss- <name>


Require admin right

Enable rss feed


Require admin right

Disable rss feed, doesn't remove the DB


Require admin right

Direct method of configuring rss feeds also obtainable by using @configure style-rss

Please note, there must be no spaces (wrong: key = value bla bla correct: key=value bla bla)

List of variables for style-rss:

  • $bugzilla_assignee
  • $bugzilla_component
  • $bugzilla_creation
  • $bugzilla_priority
  • $bugzilla_product
  • $bugzilla_reporter
  • $bugzilla_resolution
  • $bugzilla_severity


@rss-setstyle Bugzilla [bugzilla] $bugzilla_resolution $title ($bugzilla_severity $bugzilla_priority assignee: $bugzilla_assignee created by: $author) - $link
@rss-setstyle gerrit [gerrit $name] $title - Diff: $link

Channel logs[edit]


Require admin right

Start to generate public logs for current channel

By default this feature is disabled, no channels the bot is invited to are logged, unless you enable it
Channels with logging and their logs can be found on toollabs:wm-bot/logs/index.php


Require admin rights

Disable logs

Configuration and help[edit]


Display help

You can also type @help <command> to display 1 line help for the command


Require admin rights

Change the language for the channel - this will change the language bot will speak for all users in the channel

Example: @language en


  • cs
  • de
  • en
  • zh
  • ko
  • pt


Requires admin rights

Change various keys

Key Type What is it
infobot-auto-complete bool enable autocompletion so that typing !k would display value of !key should there be no other key starting with identical char (default is false)
infobot-help bool Provide a help for infobot in case you type a nonexistent key
infobot-case bool whether keys are case sensitive (default is true) - that allows you to create !key as well as !Key turning it off (by setting false) will hide the keys that were created later
infobot-sorted bool sort the infobot in html
logs-no-write-data bool disable writing of logs to storage, this is obsolete feature and shouldn't be ever used
suppress-warnings bool doesn't send any errors to channel
ignore-unknown bool doesn't parse input from users who aren't in trust list, that disable all bot features from users who aren't trusted
respond-message bool send a message to user who attempt to speak to bot
infobot-trim-white-space-in-name bool remove white space
respond-wait int delay to wait between responses from response message
recent-changes-template string
This is the message template for rc item
variables: contains
$wiki Name of the wiki
$url The URL to the index.php for the language the edit was found on. (doesn't work for "all" wikis bugzilla:49874#c3)
$username Username of the editor
$encoded_username URL encoded username
$encoded_wiki_username Same as $encoded_username only replaces spaces with _ instead of + and preserves :/() characters
$link revision ID of the edit
$page verbose page name
$encoded_page URL encoded page name
$encoded_wiki_page Same as $encoded_page except replaces spaces with _ instead of + and preserves :/() characters
$summary Edit summary
$fullurl Returns $url?title=$encoded_wiki_page for new pages
Returns $url?diff=$link for edited pages
$action returns created or modified depending on if it is a new page or not
$flags marked as minor or bot edit
null <default value>: Change on $wiki a page $page was modified, changed by $username, link: $url?diff=$link edit: $summary
style-rss string message template for rss item (variables: $name $author $title $link $description)
default-link-wiki string The default wiki to use as the base for links created using @link or @linkie-on (default: en") (complete list of known and acceptable wikis can be found on GitHub)

The current value of the content of a key can be retrieved like:

@configure recent-changes-template

Note: Returns Value of recent-changes-template is: <default value> if not set.


@configure ignore-unknown=true

Please note, there must be no spaces (wrong: key = value bla bla correct: key=value bla bla)

List of variables for style-rss:

  • $bugzilla_assignee
  • $bugzilla_component
  • $bugzilla_creation
  • $bugzilla_priority
  • $bugzilla_product
  • $bugzilla_reporter
  • $bugzilla_resolution
  • $bugzilla_severity


@rss-setstyle Bugzilla [bugzilla] $bugzilla_resolution $title ($bugzilla_severity $bugzilla_priority assignee: $bugzilla_assignee created by: $author) - $link
@rss-setstyle gerrit [gerrit $name] $title - Diff: $link


Require admin rights

Part current channel preserving the configuration and database


Display your user level


Require admin rights

Disable output to a channel


Require admin rights

Enable output to a channel


Require admin rights

Leave channel and remove the configuration, logs and db. The data can't be recovered once removed, so please don't use this command in case you want to keep logs.

Linkie (wiki link)[edit]


Turns the last line of wikilinks in the channel to actual links using the default wiki specified in the default-link-wiki parameter of @configure.


Requires admin rights

Turns on the automatic linker in the channel using the default wiki specified in the default-link-wiki parameter of @configure.

When linker is on, every wiki link similar to [[page]] will be translated to url


Requires admin rights

Turns off the automatic linker in the channel.



Resolve instance id / name / fqdn


Provide info for instance


List users in a project


List instances in project


Display info about user

Relay of messages from scripts and other tools[edit]

Useful if you need to send a message to any irc channel from wikimedia labs


Requires admin rights

This command is useful if you need to send a message to any irc channel from wikimedia labs, but you don't want to create a bot for that. If you enable relay, anyone on labs will be able to send a TCP message to wm-bot:64834 in format of:

#channel message is here

And a bot will relay it to your channel

Simple shell script to relay "hello world" to channel #wm-bot


echo "#wm-bot hello world" | nc wm-bot.eqiad.wmflabs 64834 -w0


Requires admin rights

Turn off a relay


Requires admin rights

Generate a token for your channel which needs to be provided in a message in order to relay it, example:

#channel TOKEN message is here


Requires admin rights

Disable token

Operator tools - channel maintenance tool[edit]


Requires admin

Enable optools - that let you execute @kb @jb and @kick in a channel, these commands require channel to be registered and bot needs to have +o in chanserv


Requires admin

Disable optools


Requires admin

Bot will not deop itself after op action


Requires admin

Bot will deop itself after op action


Requires admin

@kb user <reason>

Kickban a user from the channel


Requires admin

@jb user

Set a redirect ban. This is supposed to be used for people who join flood channel because of temporary connection issues


Requires admin

@q user

Quiet a user


Requires admin

@unkb user

Removes a ban of user -- bugzilla:53600 "@unkb can't unban user kicked from channel"


Requires admin

@unq user

Removes a quiet from user


Requires admin

@kick user <reason>

Kick user from a channel

Git Hub[edit]

Bot can echo push and commit messages for github repositories to any channel. The detailed setup is below:

IMPORTANT: Channel must have relay on, so if you didn't do that yet, run @relay-on

  1. Enable relay - by running @relay-on
  2. Insert a repository by running @github+ <full name of repo>
  3. Install a webhook (see screenshot bellow)

For every repository for which you wish to receive messages to your IRC channel, install webhook to http://wm-bot.wmflabs.org/github/index.php in settings of repository see example screenshot:

Screenshot of example github hook configuration

Known issues: If you set up a token for channel relay, you will need to remove repository and readd it because tokens get added to database only when repository is inserted.


Requires trusted

Insert a repository full name into a database of your channel. If your repository is http://github.com/benapetr/test-100 then full name is benapetr/test-100

For this to work you also need to install webhook into github, see above how to do that.


Requires trusted

Removes a repository full name from database, hooks for this repository will be silently ignored.

System admin[edit]

These commands are not useful for regular users


Require root rights

Restart the process of bot


Require admin rights

Reload configuration of the channel


Requires root

This is a low-level system command that tell a bot to unload specific module from system


Requires root

Load a module to system

Files and logs[edit]

Data: https://bots.wmflabs.org/~wm-bot/db - database of infobot

Channel logs: https://bots.wmflabs.org/~wm-bot/logs/ (raw) or toollabs:wm-bot/logs


The bot will talk any language you want in specific channel. All you need to do, is ask admin of bot to say @language <code>

You can translate the bot to your language by creating a subpage, example Wm-bot/ru for russian. Then just translate the default english file.

Supported languages are:

For developers[edit]


Source code is in git type

git clone https://github.com/benapetr/wikimedia-bot.git

to download it


In order to compile the bot, you need a C# compiler like gcs or microsoft's csc. Visual Studio or MonoDevelop are the recommended IDE's: they allow you to just open the project file and hit make.

This is a most simple way to build stuff on debian:

# after you checkout the bot
cd wikimedia-bot

Setting up[edit]


  • When you build the bot for first time, there should be a binary either in bin/Debug or bin/Release (depends if you directly invoke xbuild or use the make script). Pick one of these binaries.
  • Create a folder and optionally a unix user which you will use to run the wm-bot under as a service
  • Copy the binary into root of that path, let's call it $wmibhome
  • Create folder $wmibhome/configuration
  • Create file $wmibhome/configuration/wmib.conf and put there following text
// This is a username for a bot
// This password is optional and bot will use it to auth with nickserv in case you provide it
// This is a root url that will be used in queries like @info
// Whether bot uses a bouncer or not
// Debug channel
// Irc server bot will connect to
// This is css style that will be used for dynamically created html pages
// This is interval that bot will send messages to network server to in milliseconds, lower the interval is
// faster the bot will send messages to server. Low interval may result in k-line on some networks.
// Nickname for primary instance
// Optional mysql username
// Optional mysql host
// Optional password
// Name of database to store items to (by default bot doesn't use mysql, but some extensions might want to)
  • chown this file to wm-bot user and change chmod to 600, this file is dynamically updated by a bot, never write to it when bot is running
  • create database of bot administrators in $wmibhome/configuration/admins example bellow
.*@wikimedia/Petrb|root|this is a secret password|root

These users will be globally recognized in any channel, first column is regular expression to match irc hostname, second is user level, third is password for system console, fourth is username for system console

  • now you can launch the bot (mono wmib.exe)

Restarting the bot[edit]

See admin guide at wikitech:wm-bot

External links[edit]