Peeve

About

What is Peeve?

Peeve is a semi-complex ircbot coded in python, inspired mostly by xkcd's bucket.

Peeve is still a work in progress (as is the documentation, including this document), but even after just two days of programming he has some nice capabilities. He's actually in version 2.0 now, and fully functional.

What can Peeve do?

For details, see below.

What will Peeve be able to do?

As I said above, I'm still working on peeve and there's a few things I'd like to add:

If you have any suggestions for more features, please add a comment at the bottom of the page.

I can has source?

Why, certainly. Just ask.

Basic Documentation

Basics

Peeve differentiates between three types of messages:

  • Channel message - A normal channel message
  • Bot message - Usually a message when peeve is addressed directly
  • Bot command - Usually a message prefixed with an exclamation mark

Channel message

At the moment peeve will only react to normal messages when a factoid is triggered (see below).

Bot message

When peeve is addressed directly by prepending his nickname and any separating character(s), peeve will assume the message is meant to be a command to him. Peeve will assume any private messages sent to him directly are bot messages.

When peeve recieves a bot message, the chain of responsibility is as follows:

  1. Try to handle the message as an owner command
  2. Try to handle the message as a bot command
  3. Try to handle the message as a factoid specification
  4. Try to trigger a factoid
  5. If the message could not be understood, peeve responds with Whut?

Bot command

When a channel message is prefixed with an exclamation mark, peeve assumes this is a bot command. Peeve does not assume every bot command was meant explicitly for him, and does not respond if it does not match a known command. The bot commands are meant to be unintrusive utilities, e.g. googling.

Nickserv Identification

When connecting to a server peeve expects (but does not require) a promt for identification from nickserv, and will respond by sending the configured password.

Peeve is coded to use the identification confirmation as the trigger to join the default channels. Without nickserv, peeve will not automatically join the channels but can still be told to join a channel by sending a privmsg with a join command (see below).

Owner Commands

There are currently a few different owner commands, which peeve will refuse from any other nick than the one marked as owner in the configuration.


peeve, quit # Tell peeve to quit

peeve, quit restart # Tell peeve to quit and restart

peeve, join #channel # Tell peeve to join #channel

peeve, part #channel # Tell peeve to part from #channel

peeve, leave #channel # Same as part #channel


Note that peeve will only respond to these when addressed directly (see Bot message above).

Factoid Database

The factoid database is still quite simple, but will suffice for most things.


Factoid activation

Whenever peeve recieves a message that does not activate any other command, he will strip the message down to alphanumerical characters and spaces (removing duplicate spaces). The result will then be searched for in a MySQL database. If a match is found, the corresponding stored response will be executed.


Factoid management

Example

Factoids can be added by saying for example

peeve, hello <reply> Hello to you too

after which saying hello will cause peeve to reply Hello to you too.

Format

The word inside the <>-brackets is the action, the text before that (excluding the naming of peeve) is the trigger and the text afterwards is the factoid message. When adding to the database, the trigger is stipped as described above and used for factoid activation.

Actions

If the action is <reply>, the factoid message is simply echoed back when the factoid is activated.

If the action is <do>, peeve responds by using the factoid message as an CTCP action, e.g:

<spacewarp> dance
* peeve does a little dance

For any other action, the <>-brackets are removed and the entire command is used as the factoid message for an ordinary reply.

Notes

Note that because of how the trigger is handled, 'Hello', 'heLLo?', 'HELLO!' and etc. all result in the same trigger 'hello'.

There may be multiple factoids using the same trigger. In that case, when activating a factoid, a random factoid for that trigger is chosen.

Googling

Saying

!google <query>

or

peeve, google <query>

will cause peeve to perform a google search for <query>, i.e. whatever is after the word 'google'. Peeve will then reply with the title and uri of the first result.

Dice Rolling

As a response to the bot command !roll [...] peeve is able to parse simple to not so simple dice statements. The basic syntax for the command, in pesudo-BNF, is:

!roll <dice1> [ ('against'|'vs'|'vs.') <dice2> ]

The dice statements (dice1 and optionally dice2) are a bit more complex, but sort of looks like the dice rules from rpg's.

Examples

!roll d6 # Roll a six-sided die

!roll 2d10 # Roll two ten-sided dice and return sum

!roll 2d6 -2 # Return sum of two six-sided dice, minus two

!roll 1d20 +5 - 2d6 # One twenty-sided die, plus five, minus two six-sided dice

!roll +4 - 3d10 # (Note the '+' before the '4')

!roll d10 against d10 # Roll two ten-sided dice against each other

!roll d6 vs d10 -2 # Roll a six-sided die against a ten-sided minus two

!roll d10 vs. +8 # Roll a ten-sided die against a contant

Misc. Commands

peeve, help # Give the uri to this page

peeve, about # Ditto

Comments

Add a comment: