Skip to content

Factoid driver

Alex Bramley edited this page Jan 2, 2012 · 3 revisions

The factoid driver implements infobot-ish behaviour.

Commands

All the factoid driver's commands, apart from the standard key lookup, require the bot to be addressed by nick. This means starting the line typed to the channel with the bot's nick, followed by any of : ; , > - and optional trailing spaces.

Adding Factoids

There are two ways to teach the bot something new. The first form looks like this:

botNick: <factoid key> := <literal value>

e.g.

<user1> sp0rkle: github url := http://github.com/fluffle/sp0rkle
<sp0rkle> user1: Woo, I now know 1 thing about 'github url'!
...
<user2> github url
<sp0rkle> http://github.com/fluffle/sp0rkle

And the second form looks like this:

botNick: <factoid key> :is <factoid value>

e.g.

<user1> sp0rkle: your mum :is so fat!
<sp0rkle> Woo, I now know 1 thing about 'your mum'!
...
<user2> your mum
<sp0rkle> your mum is so fat!

The second syntax may be extended to cover other conjugates of the verb 'to be' if people care enough.

Setting a trigger probability

This, like many of the other factoid driver commands, operates on the last factoid triggered. This is stored on a per-channel basis to avoid confusion (and may be time-limited in the future). Setting a trigger probability ensures factoids with an extremely common key such as :) only result in a reply from the bot a fraction of the time, to avoid irritating channel users. The syntax is:

botNick: chance of that is <N>

where <N> is a floating point number in the range (0.0,1.0] or an integer percentage expressed as <N>%.

e.g.

<user2> your mum
<sp0rkle> your mum is so fat!
<user2> sp0rkle: chance of that is 30%
<sp0rkle> user2: 'your mum' was at 100% chance, now is at 30%.

Insert witty retort of 'yo momma so fat she got 110% chance of triggering a factoid' here, if appropriate.

Removing a factoid

This also operates on the last factoid triggered, causing that value for the factoid key to be forgotten. It will not delete other values for the same key. The syntax is:

botNick: forget that
botNick: delete that

e.g.

<user2> your mum
<sp0rkle> your mum is so fat!
<user2> HEY, NO SHE AIN'T!
<user2> sp0rkle: forget that
<sp0rkle> user2: I forgot that 'your mum' was 'your mum is so fat!'.

Fat moms reading this: THIS IS NOT A DIET STRATEGY; STOP EATING ALL THE PIES.

Replacing a factoid value

This is a basic edit operation, that completely replaces the value of the last factoid triggered with the given one. Regex editing will come sometime soon, when Go's new regex library appears. The syntax for this is:

botNick: replace that with <new stuff>

e.g.

<user2> your mum
<sp0rkle> your mum is so fat!
<user2> But I *like that! Aaawww yeaaahhhhh.
<user2> sp0rkle: replace that with your mum is so hot!
<sp0rkle> user2: 'your mum' was 'your mum is so fat!', now is 'your mum is so hot!'.

Retrieving all values for a factoid key

This command prints the known values for a key to the channel. If there are more than 10 of them, the bot requires you to do this in a privmsg directly to it, to avoid spamming channels with mounds of factoid data. The syntax is:

botNick: literal <key>

e.g.

<user2> sp0rkle: literal your mum
<sp0rkle> your mum is so fat!
<sp0rkle> your mum is so lazy!
<sp0rkle> your mum conforms to many negative stereotypes and has become the source of much humour on the internet.
<user2> Oh god, why?!