mttlbot2

mttlbot2 is
the name of a project to create a useful bot for the #swig IRC channel. The basis for the project is
Bot-BasicBot-Pluggable
which has been extended with additional modules. The primary developer is
Toby Inkster.

The primary installation of
mttlbot2 is a bot that usually
hangs out in #swig
and #mttlbot
on Freenode IRC, amongst other channels. It generally goes by the nickname
of mttlbot.

If there are any other channels you'd like mttlbot to frequent, find
tobyink on Freenode and ask him.

Source Code

Commands

Some commands need to be "addressed" to mttlbot2. There are two ways of
addressing data to mttlbot2 - either send a private message, or prefix a public (channel)
message with "mttlbot:" or "mttlbot," (assuming that mttlbot2's nick is "mttlbot").
Some other commands are understood without being explicitly addressed.

Each command supported by mttlbot2 is provided by a module. The modules
currently provided by mttlbot2 are described below.

Modules

The following modules are installed on Toby Inkster's instance of mttlbot2:

AccountPasswords

Some other modules (just Relay at the moment) require users to have passwords. This
module allows them to set passwords. It's recommended you use private messaging when
setting a password. Setting your password in a public channel is a little silly.
Passwords are stored in the quad store, so available to anyone. They are SHA1 hashed,
but still, I'd recommend not using an especially sensitive password, as it will be
vulnerable to dictionary attacks.

You can also use SET PASSWORD HASH sha1hash oldpass to set a
password by directly supplying a SHA1 hash rather than the plain text password.
Use lower-case hex, or else it will not be matched.

There's not currently a password recovery tool.

MicroTurtle

mttlbot2 parses RDF data posted to any channel it's in or received as a private message.
It accepts a variant of Turtle called MicroTurtle. Any message that matches the regular expression /#mttl\b/
(i.e. the string #mttl followed by a non-word character such as a space) is
treated as MicroTurtle - the part before #mttl is treated as a comment; the
part after, as data.

Data is entered as a named graph in mttlbot2's quad store, and a URI for the graph
is returned to the user as a reply.

MicroTurtle data does not need to be addressed to mttlbot2.

NickServ

This module doesn't provide any commands. It authenticates mttlbot2 with NickServ.

Note function definition is an extension to SPARQL, allowing frequently used SPARQL queries to be saved. Placeholders ?1, ?2, etc are used for function arguments. It's possible to define different functions with the same name provided they take different numbers of arguments. Note that the UNDEFINE command above only deletes the variant of who_knows that takes one argument.

mttlbot2 also provides an extension to SPARQL CONSTRUCT and DESCRIBE queries allowing you to choose the output format.

SPARQL Query commands should be explicitly addressed to mttlbot2
or the first word of the command must be capitalised (but the latter
only works if the first word is 'SELECT', 'ASK', 'CONSTRUCT' or 'DESCRIBE' - not
'BASE' and 'PREFIX'). Otherwise the command is ignored.

RDFStore

This module doesn't provide any commands. It just provides a hook for other modules.

Relay

This module provides message relaying. You give mttlbot the nick
that the message is being relayed from (i.e. your nick... somewhat redundant
I suppose), your password (from AccountPasswords) the channel to
relay the message to, and then the message.