Infobot(Tcl)
2001 by Mac-arena the Bored Zo
Infobot(Tcl) is a brand new script for eggdrop. It was first implemented back in 1999 or 2000 with no more than query and add, and now offers many commands which are shown below. Kryten is used as the name of the bot.
+--PUBLIC
| |
| +-QUERY
| | kryten, (entryname)?
| | Retrieves an entry from the database and prints it to the channel in a
| | randomised format.
| | KNOWN BUGS
| | Does not print an error when an unknown entry is requested.
| |
| +-FORGET
| | kryten, forget (entryname)
| | kryten, forget (entryname) and (entryname)
| | kryten, forget all references from (entryname)
| | Removes an entr(y|ies) from the database, printing a confirmation message.
| | RESTRICTIONS
| | Will not work on locked entries. (See Features:Lock below.)
| |
| +-REPLACE
| | kryten, no, (entryname) is (content)
| | kryten, no, (plural entryname) are (content)
| | kryten, no, I am (content)
| | Changes an entry.
| |
| +-ADD
| | kryten, (entryname) is (content)
| | kryten, (plural entryname) are (content)
| | kryten, I am (content)
| | Puts an entry into the database, printing a confirmation.
| |
| +-CALCULATE
| | kryten, calc (algebra)
| | kryten, calculate (algebra)
| | kryten, (arithmetic)
| | Performs an algebraic and/or arithmetic calculation. Supports all Perl
| | operators as well as Tcl library functions.
| |
| +-STATUS
| | kryten, stats?
| | kryten, status?
| | Prints a message containing vital info about the Infobot, including uptime
| | and DB size.
| |
| +-DEFINE
| | kryten, what's the definition for (entryname)?
| | kryten, what is the definition for (entryname)?
| | Gives the straight definition for an entry, without filtering it ($who,
| | random, references, etc. are not expanded).
| |
| +-LOCK
| | kryten, lock (entryname)
| | Adds the <lock> tag to an entry.
| |
| +-UNLOCK
| | kryten, unlock (entryname)
| | Removes the <lock> tag from the entry.
| |
| +-DNS
| | kryten, dns (hostname|nickname)
| | kryten, nslookup (hostname|nickname)
| | kryten, dns for (nickname)
| | kryten, nslookup for (nickname)
| | Prints the result of a DNS lookup on a hostname or the hostname associated
| | with a nickname.
| |
| +-TELL
| | kryten, tell (nickname) about (entryname)
| | Forwards an entry to another person.
| |
| +-SEARCH
| kryten, search for (regexp)
| kryten, look for (regexp)
| Greps the DB. (Does not escape many characters that otherwise would be.)
| NOTE: DOES NOT WORK YET! Planned for a future version.
|
+--DCC
|
+-LOCK
| .lock (entryname)
| Locks an entry (adds a <lock> tag). (Same as public/private lock command.)
|
+-UNLOCK
| .unlock (entryname)
| Unlocks an entry (removes its <lock> tag). (Same as public/private
| unlock command.)
|
+-LOOKUP
| .lookup (entryname)
| Looks up the data associated with entry in the database. (Same as
| public/private query.)
|
+-LIST
| .listdb
| Logs every entry in the database, in the order it was added. Can be VERY
| long.
|
+-FORGET
| .forget (entryname)
| Removes an entry (just like public/private forget).
+-IMPORT
.importdb (relative path)
Imports an Infobot(Tcl) database file into the bot's database. Note that
you do not need to keep the DB file you import afterward; it will be saved
next time the bot dumps its DB.
Features
In addition to the above commands, Infobot(Tcl) sports a number of features used within entries themselves. Features marked [NEW] are not found in infobot(pl) as of this writing.
$who [NEW]
This one is in infobot(pl), but to a lesser degree. Infobot(Tcl) expands $who differently depending on how it is capitalised. Assuming the querier's nickname is 'fGewA':
$who == fgewa
$Who == fGewA
$WHO == FGEWA
$arg/Functions [NEW]
Only works if your entry's name is of the format 'entry()'. This allows you to make an entry which relies on user input for part of its content. For example:
>kryten, google(FOLDOC)?
(google() is '<lock> <reply> that would be at http://www.google.com/search?q=$arg')
that would be at http://www.google.com/search?q=FOLDOC
There is also $uarg, specifically made for URLs. It escapes ungood characters and changes spaces to + signs, thus certifying that its expansion will be URL-kosher. (Note that functions are not only for URLs.)
Random
Entries containing | will be expanded to a random result. Assuming an entry containing 'foo | bar | baz', the querier might get 'foo', 'bar', or 'baz'.
<reply>
Does not apply the random Infobot formats (e.g. 'I think x is y...') to the entry.
<action>
Delivers the entry as an action (/me).
Subentries [NEW]
With subentries, you can make an entry into a DB of its own. The DB is just like the primary DB, even in that it can contain more DBs! Queriers specify entries within these sub-databases with the format entry1:entry2.
A database entry should look like this:
foobar == {foo bar} {{foo bar} foobar} {foobar {foo bar}}
Notice the braces around multi-word entrynames and contents.
Subentry queries are delivered so:
kryten, Mac error:11?
References [NEW]
References allow you to link an entry into another entry. It works like this:
>kryten, y is z
(y == 'z')
>kryten, x is &y
(x == '&y' - y has not been put into x in any way)
>kryten, x?
x is z
>kryten, no, y is x
(y == 'x')
>kryten, x?
x is x
>kryten, x y z is a b c
('x y z' == 'a b c')
>kryten, a b c is &{x y z}
(note that in this reference, curly braces are required (>1 word in
reference)
>kryten, a b c?
a b c is a b c
Locks [NEW]
With locks you can define an entry as being changeable (and revocable) by no one but the bot or channel owner(s). Locks can be set by default by adding the <lock> tag (just like <reply>). You can also use the lock and unlock commands (see above) if you're the owner.
Lacks
Now the things Infobot(Tcl) doesn't have (yet) that infobot(pl) does.
s///
You cannot partially change an entry. You must replace it.
karma, nickometre
Low on the priority list due to frivolity.
join/part
Since eggdrop itself provides similar facilities, this is not needed.
\
May not work in a few contexts. Should work in most. Email your friendly neighbourhood Bored Zo if you find one in which it doesn't.
$date
$who was hard enough to implement. ;)
weather, metar, internic, traceroute, translate
Not to be implemented in Infobot(Tcl). There is, however, a translator script available.
change (currency)
You could use calculate for now.
excuse
Actually, the only reason this doesn't exist is because the excuse calendar is not yet in the default DB file. Easily implementable on a stock IB(Tcl) using locks and random. (In fact, this is one of the available IB(Tcl) factpacks.)
ignore, op, die
Provided (in various forms) by eggdrop.
About Infobot(Tcl)
Infobot(Tcl) was based on Infobot (referred to here as Infobot(pl)), by oznoid (aka kevin lenzo), <lenzo@cs.cmu.edu>. Infobot(Tcl) was written from the ground up by Mac-arena the Bored Zo, <macrulez@softhome.net>, except for some strings (namely the Infobot entry-reply formats, the stats reply, and something else he can't remember as of this writing) which were written by oznoid.
GPL
Infobot(Tcl) is distributed under the GNU General Public License (see the included LICENSE file). It has ABSOLUTELY NO WARRANTY WHATSOEVER BY ANY MEANS KNOWN TO MANKIND. While the Bored Zo may choose to help you with your bot, he might also choose otherwise - it's entirely up to him. Speak kindly.
You should have received a copy of the GNU General Public License along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA
02111-1307, USA.
You can also obtain the License from <http://www.gnu.org/copyleft/gpl.html>.