1 This is bobot++.info, produced by makeinfo version 4.7 from
4 This file documents Bobot++ by Clinton Ebadi and Etienne Bernard
5 (original author, no longer works on program).
7 Copyright 2002,2004,2005 Clinton Ebadi
9 Permission is granted to copy, distribute and/or modify this document
10 under the terms of the GNU Free Documentation License, Version 1.1 or
11 any later version published by the Free Software Foundation; with no
12 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
16 File: bobot++.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir)
18 This document describes Bobot++ by Clinton Ebadi and Etienne Bernard
19 (original author, no longer works on program).
21 This document applies to version 2.1.5 of the program named Bobot++
23 Copyright 2002,2004 Clinton Ebadi
25 Permission is granted to copy, distribute and/or modify this document
26 under the terms of the GNU Free Documentation License, Version 1.1 or
27 any later version published by the Free Software Foundation; with no
28 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
41 --- The Detailed Node Listing ---
45 * Configuration Files::
46 * Configuration File Placement::
68 * Adding New Commands::
70 * Scheme User Levels::
72 * Misc Scripting Stuff::
81 * High Level Message Functions::
82 * Low Level Message Functions::
85 File: bobot++.info, Node: Introduction, Next: Configuration, Prev: Top, Up: Top
90 This manual feels abused and neglected because it has almost no content.
93 File: bobot++.info, Node: Configuration, Next: Using the Bot, Prev: Introduction, Up: Top
98 Bobot++ is easy to configure. See the `examples' directory for an
99 example configuration.
103 * Configuration Files::
104 * Configuration File Placement::
107 File: bobot++.info, Node: Configuration Files, Next: Configuration File Placement, Prev: Configuration, Up: Configuration
109 2.1 Configuration Files
110 =======================
118 File: bobot++.info, Node: bot.conf, Next: bot.users, Prev: Configuration Files, Up: Configuration Files
128 `bot.conf' contains key value pairs separated by `='.
132 Comments are started with a `#' and cause the entire line to be
133 ignored. _Note that this only works when the `#' is the first character
136 bot.conf is the main configuration file for a Bobot++. The available
137 configuration variables are listed below in the format "VARIABLE
138 <default-value>: description"
140 * NICKNAME <Bobot>: The nickname of the bot (NICK is an alias for
143 * USERNAME <bobot>: The IRC username of the bot
145 * CMDCHAR <!>: The character that prefixes commands given to the bot
146 (COMMAND is an alias for CMDCHAR)
148 * IRCNAME <I'm a bobot++!>: The IRC name (or 'real name') of the bot
149 (REALNAME is an alias for IRCNAME)
151 * USERLIST <bot.users>: Name of the file where the userlist is stored
153 * SHITLIST <bot.shit>: Name of the file where the shitlist is stored
155 * LOGFILE <$LOGDIR/bot.log>: Location of the bot logfile (set this
156 to `/dev/null' to disable logging).
158 * SERVER <None>: This specifies the server to connect to. Note that
159 this has a special syntax.
161 * CHANNEL <None>: This specifies a channel the bot will join when it
162 starts up. This also has a special syntax.
166 File: bobot++.info, Node: server syntax, Next: channel syntax, Prev: bot.conf, Up: bot.conf
168 2.1.1.1 server syntax
169 .....................
171 SERVER = SERVER_NAME [PORT [PASSWORD]]
173 This will make Bobot++ attempt to connect to SERVER_NAME on port
174 PORT with the password PASSWORD. SERVER_NAME should be the address of
175 the server. PORT and PASSWORD are optional. You may use more than one
176 server line; Bobot++ will attempt to connect to the first one and, if
177 it fails, will connect to the next one in the list. There is also a
178 command to cause the bot to cycle servers. At the present time Bobot++
179 cannot connect to more than one server at a time. This is a planned
180 feature of 3.0 (which is a very long way away; the current structure of
181 the program would make it very difficult to add support for connecting
182 to multiple servers at a time in a usable manner).
185 File: bobot++.info, Node: channel syntax, Prev: server syntax, Up: bot.conf
187 2.1.1.2 channel syntax
188 ......................
190 CHANNEL = NAME:INITIAL_MODES:MODES_TO_KEEP:CHANNEL_KEY
192 You may have any number of channel lines. When Bobot++ starts it will
193 attempt to join and gain ops in every channel listed. It will join NAME
194 and set the channel modes to INITIAL_MODES (e.g. "nt") if it is able to
195 gain operator status. It will then maintain MODES_TO_KEEP. If the
196 channel requires a key to enter simply set CHANNEL_KEY. Every argument
197 except for NAME is optional.
201 `CHANNEL = #foo:nt:nt:bar'
203 The bot will join `#foo' with the channel key `bar' and will then
204 maintain the modes `nt'.
208 The bot will join `#bar' and will not set any modes nor will it
209 attempt to maintain any modes.
212 File: bobot++.info, Node: bot.users, Prev: bot.conf, Up: Configuration Files
217 `bot.users' is the default file name of the userlist. It may be changed
218 in `bot.conf'. The file contains lines with the format:
220 `MASK:CHANNEL:LEVEL:PROTECTION:AUTO-OP'
222 * MASK is the host mask (e.g. `*!*username
223 .domain.com') of the user
225 * CHANNEL is a channel mask of the channels that the user has
226 priviliges to use the bot in (e.g. `*' for all channels, `#*' for
227 all non-local channel, `#foo*' for all channels starting with
228 "foo," `#bar' for channel "#bar" only, etc.)
230 * LEVEL is the user level of the user (*Note User Levels::).
232 * PROTECTION is the protection level of the user (*Note
235 * AUTO-OP is set to control whether a user is automatically given
236 operator priviliges on channel entry (*Note Automatic Op::).
240 File: bobot++.info, Node: Configuration File Placement, Prev: Configuration Files, Up: Configuration
242 2.2 Configuration File Placement
243 ================================
245 Bobot++ will look in `/etc/bobotpp/default/' for its default config if
246 none is specified on the command line. Put the configuration files you
247 want to be loaded by default in this directory. If you are not root or
248 you want to have your own personal configuration, put it in
249 `~/.bobotpp/config/default/'.
252 File: bobot++.info, Node: Using the Bot, Next: Scripting, Prev: Configuration, Up: Top
265 * Built-In Commands::
268 File: bobot++.info, Node: Starting the Bot, Next: User Levels, Prev: Using the Bot, Up: Using the Bot
273 The bot is usually installed with the binary name `bobotpp'. It accepts
274 the following command line arguments:
276 * `[--help][-h]' - Shows detailed help and exits
278 * `[--version][-v]' - Shows version information and exits
280 * `[--no-background][-b]' - Run bobot++ in the foreground
282 * `[--config-file file][-f]' - Use file instead of `bot.conf'
284 * `[--config-dir dir][-d]' - Use dir as dir to load config file from
286 * `[--config dir][-c]' - Search your config path (defaults to
287 `$HOME/.bobotpp/config/' and then `/etc/bobotpp/') for dir and
288 then loads your config data using dir
290 * `[--sys-config dir][-s]' - Looks for config in `/etc/bobotpp/dir'.
291 Note that the user dir is still searched first
293 * `[--user-config dir][-u]' - Looks for config in
294 `$HOME/.bobotpp/config/dir/'. Note that the system dir is still
295 searched after this if dir is not found.
297 * `[--debug][-D]' Makes Bobot++ print debugging info and run in the
301 The default configuration is read from
302 `$HOME/.bobotpp/config/default/' and then `/etc/bobotpp/default/' if
303 the user config is not found.
305 The bot defaults to running in the background as a daemon.
308 File: bobot++.info, Node: User Levels, Next: Protection, Prev: Starting the Bot, Up: Using the Bot
313 There are several user levels available in Bobot++ to provide gradated
314 access to commands. `!adduser' and `bot.users' use the numeric code;
315 Scheme uses the textual name for the level. By default (if no catch-all
316 setting is found in *Note bot.users::.) a user is not even a
317 `bot:user-none' and cannot execute *any* commands, even commands
318 available to `bot:user-none'.
320 0. `bot:user-none' - No *built-in* commands may be executed _by
321 default_ (commands may be added from Scheme that can be executed
322 by users of level none and the level required to execute a command
323 may be changed from Scheme).
325 1. `bot:user-user' - Will be able to execute most commands but not
326 all and cannot use masks on kicks and bans.
328 2. `bot:user-trusted' - For built-ins with a default configuration
329 this user has access to the same set of commands as an `user' but
330 may use masks on kicks and bans. Scheme commands may be added
331 which require a user to be of this level.
333 3. `bot:user-friend' - In the default configuration a user who is a
334 friend will be able to do everything short of stopping the bot.
335 Again, there may be user added commands that require a higher user
338 4. `bot:user-master' - This is the highest user level and has access
339 to every feature of the bot.
343 File: bobot++.info, Node: Protection, Next: Automatic Op, Prev: User Levels, Up: Using the Bot
348 A user added via Scheme, the `bot.users' file, or `!adduser' may be
349 protected from being deoped, kicked, or banned. There are currently no
350 symbolic levels in Scheme; just use the numeric code.
354 1. No ban. If a user is banned the bot will unban him..
356 2. No kick. The user may still be kicked but the bot will kickban the
357 user who kicked the protected user.
359 3. No deop. The bot will ensure that the user always maintains
364 File: bobot++.info, Node: Automatic Op, Next: Built-In Commands, Prev: Protection, Up: Using the Bot
369 A user may be automatically given operator status upon entering a
370 channel. Set the AOP field to "0" to disable auto-op or "1" to enable
374 File: bobot++.info, Node: Built-In Commands, Prev: Automatic Op, Up: Using the Bot
376 3.5 Built-In Commands
377 =====================
379 Bobot++ has many built-in commands that make it useful without
380 scripting support. The reference leaves off the command char; remember
381 to use whatever you defined the command char to be in `bot.conf'. If a
382 command needs the channel name then you must specify the channel as the
383 first argument to the command when private messaging the bot a command.
385 COMMAND NEEDS CHANNEL MIN LEVEL TO USE DESCRIPTION
386 `action' `do' Yes USER Causes the bot
407 `execute' *Only available
419 `loadscript' *Only available
454 File: bobot++.info, Node: Scripting, Next: Concept Index, Prev: Using the Bot, Up: Top
459 Bobot++'s most powerful feature is its scripting system. You write
460 scripts using Guile Scheme. This manual does not cover how to use Guile
461 or how to learn Scheme. *Note Guile Reference Manual: (guile)Top, for
462 the Guile reference manual and
463 `http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme.html' for a
464 good tutorial on Scheme.
466 Note that in previous versions the scripting commands where in the
467 form `bot-FUNCTION'. They are now in the form `bot:FUNCTION'. The old
468 names are still available, but are deprecated and will be removed in
469 Bobot++ 3.0. New commands are only available with the `bot:' prefix.
470 The command `perl -pi -e ``s/bot-/bot:/g'' YOUR-FILES' should be enough
471 to convert your code to use the new functions.
475 * Adding New Commands::
477 * Scheme User Levels::
479 * Misc Scripting Stuff::
482 File: bobot++.info, Node: Adding New Commands, Next: Hooks, Prev: Scripting, Up: Scripting
484 4.1 Adding New Commands
485 =======================
487 Adding a new command is simple. To register a new command use
488 `bot:addcommand'. The prototype for `bot:addcommand' is
489 `(bot:addcommand name func needs-channel? num-of-args min-level)'. The
490 `name' is a string representing the name of the command being added.
491 `func' is a function accepting `num-of-args' arguments.
492 `needs-channel?' is a bool that is true if the function needs the
493 channel name as its first arg, and false otherwise. `num-of-args' is
494 the number of args `func' will take and must be within zero (0) and
495 twenty (20). `min-level' is one of the *Note Scheme User Levels::. A
496 user must be at least a `min-level' user to use the new command. None
497 of the arguments are guaranteed to be passed; if they aren't they are
498 set to the empty string `""'. An example of a new command would be:
500 (define (hello channel name)
501 (if (string=? name "")
502 (bot:say channel "Hello world!")
503 (bot:say channel (string-append "Hello " name "!")))
505 (bot:addcommand "hello" hello #t 2 0)
507 This will display "Hello World!" if called as `!hello' and "Hello
508 World `USER'" if called as `!hello USER'.
511 File: bobot++.info, Node: Hooks, Next: Scheme User Levels, Prev: Adding New Commands, Up: Scripting
516 Hooks are a powerful feature of Bobot++. Hooks are a hybrid of ircII
517 and tiny fugue (a MUD bot) hooks with a little bit of extra stuff added
518 in. The basic idea of a hook if that you match a text against regular
519 expression and call a function if text in a message matches that regex.
520 The different types of hooks provided by Bobot++ correspond to the
521 different classes of messages that Bobot++ can recieve. A Hook also has
522 several properties, including its priority and whether or not it is a
523 fallthrough hook. Higher priority hooks are executed before lower
524 priority hooks and fallthrough hooks are executed before
525 non-fallthrough hooks of the same priority. A fallthrough hook can
526 match and processing of hooks will continue; as soon as the first
527 non-fallthrough hooks matches processing of hooks stops.
535 File: bobot++.info, Node: Creating a Hook, Next: Hook Types, Prev: Hooks, Up: Hooks
537 4.2.1 Creating a Hook
538 ---------------------
540 To add a new hook you use the function `bot:addhook'. `bot:addhook' is
541 prototyped as `(bot:addhook type regex function pri fall name)'. `type'
542 specifies the type of hook (the types of hooks are listed in *Note Hook
543 Types::). `regex' is a standard regular expression. If `regex' is
544 matched, `function' will be called. `function' will take a different
545 number of args depending on the hook type. `pri' specifies the priority
546 of the hook--higher priority hooks are executed first. This argument is
547 optional and defaults to `0'. `fall' is `#t' if the hook is a
548 fallthrough hook and `#f' is the hook is not a fallthrough hook. This
549 arg is also optional and default to `#t'. `name' is the optional name
550 of the hook that defaults to "DEFAULT". If you set the name then you
551 can have more than one hook that matches the same regexp, as long as
552 they have the same name. E.g. in a log script you could have the
553 regexps for the log function all be `".*"' and set their names to
554 `"log"' to avoid a conflict with other hooks.
557 File: bobot++.info, Node: Hook Types, Prev: Creating a Hook, Up: Hooks
562 Here is a list of the various hooks are notes on each one. The general
565 * `hooks/name' (this is the Scheme variable name of the hook)
566 - Description of the hook
577 That said, here is the list of available hooks: FIXME: write docs
580 - This hook is triggered when someone performs an action.
583 - FROM: this is the address of the person that performed
584 the action in the form `NICK ! USER @ HOST' (without the
587 - TO: This is the target of the action, which is either a
588 channel or the Bot's nick.
590 - ACTION: This is the text of the action. E.g. if someone
591 did `* foobar does baz', then ACTION would be the string
595 - Description of the hook
601 - Description of the hook
607 - Description of the hook
613 - Description of the hook
619 - Description of the hook
625 - Description of the hook
631 - Description of the hook
637 - Description of the hook
643 - Description of the hook
649 - Description of the hook
655 - Description of the hook
661 - Description of the hook
667 - Description of the hook
673 - Description of the hook
678 * `hooks/public-notice'
679 - Description of the hook
685 - Description of the hook
691 - Description of the hook
697 - Description of the hook
703 - This hook is triggered when a user begins a DCC CHAT with the
707 - FROM: This is the user's address in the form
710 * `hooks/dcc/message'
711 - This hook is triggered when a user sends a message to the bot
715 - FROM: This is the user's address in the form
718 - MESSAGE: This is the message the user sent to the bot.
721 File: bobot++.info, Node: Scheme User Levels, Next: Sending Messages, Prev: Hooks, Up: Scripting
723 4.3 Scheme User Levels
724 ======================
726 There are five levels that a user may be when interfacing with a bot:
727 NONE, USER, TRUSTED_USER, FRIEND, MASTER. The Scheme variables for the
728 user levels are `bot:user-none', `bot:user-user', `bot:user-trusted',
729 `bot:user-friend', and `bot:user-master'. See *Note User Levels:: for
730 more information on User Levels.
732 When adding a new command, think about who should be able to use it.
733 Is your command a general purpose command that helps the channel (e.g.
734 `!seen') that everyone should be able to use? Or is it something that
735 should be restricted? See *Note User Levels:: for information on what
736 level users can do what with the built in bot commands and think about
737 what level a user your command is targetted towards. You must be _very_
738 careful when giving new commands to lower level users because you can
739 do basically everything the bot can do with a script. As the scripting
740 interface becomes more powerful, you must think more about what users
741 can use new commands you add.
744 File: bobot++.info, Node: Sending Messages, Next: Misc Scripting Stuff, Prev: Scheme User Levels, Up: Scripting
749 There are several types of messages you can send with Bobot++ from
750 scripts. There is the simple, but rather limited, `bot:say',
751 `bot:action' and `bot:msg', and the more powerful, but lower level,
752 `bot:send-MESSAGE' functions. Most bots will probably only need the
753 higher level functions, but for the sake of why-not Bobot++ lets you
754 use the lower level functions (in progress).
758 * High Level Message Functions::
759 * Low Level Message Functions::
762 File: bobot++.info, Node: High Level Message Functions, Next: Low Level Message Functions, Prev: Sending Messages, Up: Sending Messages
764 4.4.1 "High Level" Message Functions
765 ------------------------------------
770 File: bobot++.info, Node: Low Level Message Functions, Prev: High Level Message Functions, Up: Sending Messages
772 4.4.2 "Low Level" Message Functions
773 -----------------------------------
775 The "Low Level" messaging functions allow you to do things like send
776 CTCP messages. You probably want to read rfc 2812 and the CTCP spec
777 before using these. If you have no idea what these do, read rfc 2812
778 (IRC Client Protocol) and CTCP spec. These functions all return
779 `*unspecified*' always, so don't use the return value for anything.
781 * `bot:send-CTCP to command message' `to' is the target of your CTCP
782 message, `command' is the CTCP command, and `message' is the
783 message (or arguments) of the command. Make sure to
784 `bot:ctcp-quote' the message!
788 File: bobot++.info, Node: Misc Scripting Stuff, Prev: Sending Messages, Up: Scripting
790 4.5 Misc. Scripting Stuff
791 =========================
793 These are a few useful things that I thought people writing scripts
796 If you want to execute code when the bot exits, just do `add-hook!
797 bot:exit-hook THUNK' where THUNK is an argumentless procedure (a
798 thunk). When the bot exits your thunk will be called.
801 File: bobot++.info, Node: Concept Index, Next: Function Index, Prev: Scripting, Up: Top