The infobot module aims to give the functionality of Infobot (and more) implemented from scratch as a botnix module using SQL for storing infomation.
The bot's replies are all configurable in botnix.conf, you may have as many as you like of each type of reply.
Working example of the configuration directives, expansions listed below.
inf-replies "I heard %k %w %v" inf-replies "They say %k %w %v" inf-replies "%v...I think" inf-replies "someone said it was %v" inf-replies "%k? not telling >_>" inf-dontknow "Sorry %n I don't know what %k is" inf-dontknow "%k? no idea %n" inf-notnew "but %k %w %v :(" inf-notnew "fool, %k %w %v =p" inf-heard "%s told me about %k on %d'" inf-heard "About....%d', 'I think it was %s that said it" inf-heard "I think it was %n that said it, way back on %d" inf-confirm "okay your lordliness" inf-confirm "as you wish" inf-confirm "whatever...but i'll remember it ;/" inf-loggedout "You're a mild idiot %n, log in and try again" inf-locked "that phrase is locked, log into the bot, run '%m, unlock %k'" inf-forgot "I forgot %k"
- %k - Key - The relavent phrase
- %w - Word - At the moment "is" or "are", you should always use this rather than hardcoding (the bot remembers how it was taught as it learns from both "A is B" and "A are B")
- %n - Nick - Nickname of the person asking
- %m - Mynick - The bot's current nickname
- %d - Date - When the bot learnt about the phrase
- %s - Setby - Who taught the bot the phrase
- %l - Locked - "locked" or "unlocked" depending on (surprise surprise) if the phrase is locked or not
- %v - Value - The definition of the phrase
Only %k and %n are set on "dontknow" events.
The module recognises the following prefix on all commands:
Botnick, no Botnick,
The comma may be substituted for a colon or a space.
The module uses these prefixes to give every command a "level":
- No prefix: 'Passive' -- The bot will learn, but will not overwrite existing facts, not will it respond to you unless you are asking a question.
- 'Botnick' prefix: 'Addressed' -- The bot will respond to you and learn, regardless of if you are asking it a question. It will not overwrite existing factoids.
- 'no Botnick' prefix: 'Override' - The bot will respond to you and learn, regardless of if you are asking it a question, and will overwrite any existing factoids that you teach it new definitions of.
The bot recognises and learns from sentences in the form:
foo is bar foo are bar foo was bar foo arent bar foo aren't bar foo can bar foo can't bar foo cant bar foo will bar foo has bar foo had bar foo r bar (yes, really.) foo might bar foo may bar Actions: /ME is bar (remembered by the bot as: nickname was bar)
Gives 'foo' the value 'bar', prints a confirmation message if the level was Addressed or above.
The bot will remember which of "is" and "are" etc. you used and will use the same one when it is queried.
If 'foo' is already set and the bot is addressed, then the bot will reply saying so, or if the level is Override then the value will be overwritten.
Adding to an existing phrase
To add extra text to an existing phrase, use 'also'. For example:
<Brain> sporks, lollertest <Sporks> lollertest is abc or def, maybe? <Brain> sporks, lollertest is also ghi <Sporks> Gotcha. <Brain> sporks, lollertest <Sporks> lollertest is abc or def or ghi... I think
If you use a | symbol at the start of your text, e.g.
newfactoid is also | new stuff here
then the 'or' shown above will not be inserted, as the bot will treat this as creation of a new factoid section in an existing factoid.
Certain tokens may be places in a phrase definition and will be expanded by the bot when it is asked about them:
- <me> - The bot's current nickname
- <who> - The nickname of the person asking about the phrase
- <random> - Random nickname of a user in the channel
- <date> - The date the phrase was learnt
- <now> - The current date
If a reply begins with "<reply>" then the text will be expanded and printed as-is.
If a reply begins with "<action>" then the text will be expanded and sent as a CTCP ACTION (/me) line.
Also multiple answers may be specified with the format:
A random answer will be selected when the bot is queried.
Prints a random definiton of phrase, if there are no definitions and the level is Addressed or higher print a reply saying it doesn't know.
lock phrase unlock phrase
This command is only availiable if you are logged into your bot, when a phrase is locked it may not be modified by anyone until it is unlocked again.
who told you about phrase?
Prints out a reply saying who taught the bot 'phrase' and when.
If level is Addressed or higher then print out the bot's uptime, number of records and counts of modifications and queries.
literal phrase literal phrase?
Prints out the literal value of phrase, no expansions are carried out.
Makes the bot forget phrase level must be Addressed or higher, if phrase is locked or doesn't exist then an error message is printed.
All the infobot module code and helper script should be up to date in the Botnix SVN repository. If not, slap someone.
The Infobot module was originally written by Om, and has been expanded upon by Brain.