Mwbot

mwbot is an IRC bot written by amidaniel to help on the #mediawiki support channel on the freenode IRC network. It also has its own channel, #mwbot. Source code is available at http://amidaniel.com/viewvc/trunk/MWBot/src/com/amidaniel/mwbot/?root=svn.

The (more or less) current list of factoids can be viewed at http://tools.wikimedia.de/~amidaniel/botbrain.html - see the @dump command below.

Quick help

 * !foo: displays factoid foo
 * !foo | quux: displays factoid foo, addressing the response to user quux
 * !foo is bar: defines factoid foo to be bar
 * !foo alias bar: defines foo as an alias for the factoid bar
 * !foo del: deletes factoid foo
 * @search foo.*: searches for the regular expression foo.* in all factoids
 * @trust host: trusts users on host, especially useful with IRC cloaks
 * @untrust host: removes trust for users on host
 * @trusted: lists trusted hosts
 * @dump: Dumps out the contents of mwbot's brain to an html file for browsing, see.

Parameters in factoids
Factoids can accept up to nine parameters, passed as space-delimited "arguments" to the factoid.


 * !foo is Hello, `1!: When expanded using "!foo bar", this will produce "Hello, bar!".
 * !foo is Hello, `e1!: URL-encodes the first parameter it receives. When expanded using "Hello, $wgGroupPermissions!", it produces "Hello, %24wgGroupPermissions!". Note that the parameters are encoded as UTF-8 which quite likely won't work for a lot of folks over IRC (may need to be changed).

Factoids can also contain other factoids "subst'ed" within them, using the following syntax:


 * !foo is Bar says `!bar``.

Any parameters of the form "`1" are expanded before internal factoids are expanded. Internal factoids can also accept parameters, for instance:
 * !foo is When you call bar with `1, you get `!bar `1``.

Sort of disgusting syntax, but it was easy to implement and hopefully not too confusing for the user :) See "!man" and "!info" for more realistic examples of how parameters are used.

Feature requests
Brainstorming sections. No guarantee anyone will ever look at this.


 * Support private messages
 * Probably not useful, given #mwbot. — Pathoschild 11:37:10, 12 November 2007 (UTC)
 * even there it meight get annoying to have someone play with the bot. Also, you have to know about it. Private messages is more intuitive, at least to IRC people. -- Duesentrieb ⇌ 17:00, 12 November 2007 (UTC)
 * Done. AmiDaniel 09:40, 18 December 2007 (UTC)
 * Automatically search when no exact match is found
 * Done. AmiDaniel 09:16, 18 December 2007 (UTC)
 * Automatically trust cloaked user addresses, depending on pattern (something like ^(wikipedia|wikimedia|mediawiki|wikia/))
 * Probably a bad idea; cloaks are given out rather liberally. — Pathoschild 11:37:10, 12 November 2007 (UTC)
 * dude, we are a wiki place :) Seriously, some channels even have the bot accept factoids from anyone. -- Duesentrieb ⇌ 17:00, 12 November 2007 (UTC)
 * Yes, but those bots are usually for play. It would suck to have someone overwrite your detailed explanation of a fix with "LOLZ BURN", unless we implement a history feature. ;) — Pathoschild 19:32:54, 15 November 2007 (UTC)
 * fair enough. point taken -- Duesentrieb ⇌ 19:51, 15 November 2007 (UTC)
 * Meh, implemented. Will now match regexes. AmiDaniel 09:29, 15 December 2007 (UTC)
 * magic factoids for config settings and manual pages: !$wgXXX -> http://www.mediawiki.org/wiki/Manual:$wgXXX
 * Done with parameter substitution. Try "!man $wgXX". AmiDaniel 09:29, 15 December 2007 (UTC)
 * List aliases. MinuteElectron 11:45, 18 November 2007 (UTC)
 * Done with @dump. AmiDaniel 09:09, 18 December 2007 (UTC)
 * Please sort alphabetically -- Duesentrieb ⇌ 21:59, 18 December 2007 (UTC)
 * People not on trusted list cannot use any commands (inlcluding !factoid). --Skizzerz talk 00:51, 21 December 2007 (UTC)
 * Trim whitespace from the end of commands so that clients which leave whitespace after tab-completions do not cause responses such as "person : factoid" as opposed to "person: factoid". MinuteElectron 14:52, 2 January 2008 (UTC)