wm-bot
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.
Support [edit]
In case you need any help with this bot, please contact one of its operators:
- Petrb (preferred)
- Ryan Lane
- Jeremyb
- The Helpful One
Or - fill in a ticket: https://bugzilla.wikimedia.org/enter_bug.cgi?product=Tools&component=WM-Bot
User access [edit]
Administrator [edit]
Administrator has access to all commands, the user who bring the bot to channel is always made administrator unless the bot was previously parted (in that case the previous access list is preserved). This user level can be granted to anyone else.
Trusted [edit]
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
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 and it will join your channel and give you admin permissions for that channel.
Feed [edit]
Wiki codes
- language_wikipedia
- example: fr_wikipedia
- meta_wiki
- commons
- wikidata
- outreach_wiki
- wikimania2012
- wikimania2013
- incubator_wiki
@recentchanges-off [edit]
Needs admin rights
Disable a feed of recent changes of wikimedia wikis. The database of pages you configured, will be preserved.
@recentchanges-on [edit]
Needs admin rights
Enable a feed of recent changes in current channel, you can select certain pages on selected wikis to be watched.
@recentchanges+ wiki [edit]
Require admin rights
Request bot to watch given wiki (example fr_wikipedia) this is a global setting for all channels and is needed only if the required wiki is not already being watched, because the bot is watching only certain wikis in order to save server resources, but it is capable of watching any WMF wiki. It is necessary to insert a wiki in this list (only in case it's not being watched) before you can start using feed for that project (this applies mostly for smaller wiki's because large one's are likely already watched). The bot is only watching projects for which the feed was requested.
Example: @recentchanges+ en_wikipedia
@recentchanges- wiki [edit]
Require admin rights
See + for explanation. Remove a wiki from a feed. Before you do this, make sure that no one (in all channels where bot is being used) is currently watching the feed. This command should be used only for closed projects and it's basically never needed to execute it. (It exist merely for performance optimization).
Example: @recentchanges- en_wikipedia
@RC- wiki page [edit]
Require trusted rights
Example: @RC- en_wikipedia User:Test_page
Remove a page from a list of recent changes, affects only current channel.
@RC+ wiki page [edit]
Needs trusted rights
Insert a page to a feed, example @RC+ de_wikipedia User:Test_page would make it report changes to de.wikipedia.org/wiki/User:Test_page directly to channel.
Additionally, @RC+ de_wikipedia 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.
Infobot [edit]
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
Keys may have parameters from $1 till $9 or $url_encoded_1 till 9 for url encoded parameters. $* will substitute to every word separated by 1 space only
@regsearch <regex> [edit]
Search regular expression in all values
@search <word> [edit]
Search key names and values for given word
Various commands [edit]
@add [edit]
Require admin rights
Insert a bot to another channel (@add #example)
@info [edit]
Link to html dump of database and channel info (no parameters)
@notify [edit]
For example if I was waiting for hashar, I could just send a private message
@notify hashar
to wm-bot and he send me a private message when hashar appear somewhere, or talk and such. It works even on users who are already online but idle (so it ping you when the user stop being idle).
@infobot-link [edit]
Require admin rights Create a link to infobot db of different channel, example @infobot-link #mediawiki will make a bot use db of #mediawiki this allows you to share infobot with other channels.
syntax @link #channel
Example: @infobot-link #mediawiki
@infobot-ignore+ [edit]
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
@infobot-ignore- [edit]
Require trusted right
This command remove an ignored key from list, syntax: @infobot-ignore- <item>
@infobot-detail [edit]
Doesn't require any rights
Syntax: @infobot-detail <key>
Display information about key
@infobot-set-raw [edit]
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 $*
@infobot-unset-raw [edit]
Require trusted right
Syntax: @infobot-unset-raw <key>
This command undo the @infobot-set-raw
[edit]
Require admin right
Enable shared infobot, this is necessary to execute on the channel you want to share the db of with other channels.
[edit]
Require admin right
Remove a channel from trusted relation. This channel will no longer have access to shared db.
[edit]
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.
[edit]
Require admin right
Disable shared infobot
@infobot-recovery [edit]
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.
@infobot-snapshot [edit]
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.
@infobot-snapshot-rm [edit]
Require admin right
example: @infobot-snapshot-rm previousdb
Removes a snapshot
@infobot-snapshot-ls [edit]
List all snapshots for current channel
@infobot-on [edit]
Require admin rights
Turn on infobot for current channel
@infobot-off [edit]
Require admin rights
Disable infobot on current channel
@seenrx [edit]
Requires trusted right
Tell you when user matching regex was last seen
Example: @seenrx ^[Pp]etan$
@seen [edit]
Tell you when the specified user was last seen, case insensitive and doesn't support wild cards.
Example: @seen petan
@seen-on [edit]
Require admin right
Turn on the seen for the current channel
@seen-off [edit]
Require admin right
Turn off the seen for the current channel
@rss+ [edit]
Require trusted right
Insert a new item, syntax: @rss+ <name> <url>
example: @rss+ bbc http://bbc.co.uk/rss.xml
@rss- [edit]
Require trusted right
Remove an item
syntax: @rss- <name>
@rss-on [edit]
Require admin right
Enable rss feed
@rss-off [edit]
Require admin right
Disable rss feed, doesn't remove the DB
@logon [edit]
Require admin right
Start to generate public logs for current channel
@logoff [edit]
Require admin rights
Disable logs
@help [edit]
Display help
@language [edit]
Require admin rights
Change the language
Example: @language en
Languages:
- cs
- en
- zh
@configure [edit]
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 |
| 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 | message template for rc item (variables: $wiki $url $username $link $page $summary - example: Change on $wiki a page $page was changed by $username, link: $url?diff=$link edit: $summary) |
| style-rss | string | message template for rss item (variables: $name $author $title $link $description) |
Examples:
@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
Examples:
@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
@part [edit]
Require admin rights
Part current channel preserving the configuration and database
@suppress-on [edit]
Require admin rights
Disable output to a channel
@suppress-off [edit]
Require admin rights
Enable output to a channel
@drop [edit]
Require admin rights
Leave channel and remove the configuration, logs and data base. The data can't be recovered once removed, so please don't use this command in case you want to keep logs.
@restart [edit]
Restart the process of bot
@labs-resolve [edit]
Resolve instance id / name / fqdn
@labs-info [edit]
Provide info for instance
@labs-project-users [edit]
List users in a project
@labs-project-instances [edit]
List instances in project
@labs-user [edit]
Display info about user
@reload [edit]
Require admin rights
Reload configuration of the channel
@whoami [edit]
Display your user level
User list [edit]
User list can be controlled using following commands
@trusted [edit]
Display list of users for current channel
@trustadd regex level [edit]
Add regex to defined level, example
@trustadd .*@wikipedia/John trusted
@trustdel regex [edit]
Delete regex, you can only delete trusted users
Files [edit]
Data: http://bots.wmflabs.org/~wm-bot/db - database of infobot
Logs: http://bots.wmflabs.org/~wm-bot/logs
Languages [edit]
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:
Installation [edit]
Source [edit]
Source code is in git type
git clone https://github.com/benapetr/wikimedia-bot.git
to download it
Compiling [edit]
In order to compile the bot, you need a C# compiler. Visual Studio or MonoDevelop are the recommended IDE: they allow you to just open the project file and hit make.
Settings [edit]
Main configuration file of a bot is wmib in this file you need to specify following variables:
- username - nick of bot and also for service acc
- password - for nickserv
- network
- nick
- channels
All values need to look like:
username=test;
there is no need to create any other files bot will create all databases itself
