1 This is bobot++.info, produced by makeinfo version 4.6 from
4 This file documents Bobot++ by Clinton Ebadi and Etienne Bernard
5 (original author, no longer works on program).
7 Copyright 2002 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.0 of the program named Bobot++
23 Copyright 2002 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
42 File: bobot++.info, Node: Introduction, Next: Configuration, Prev: Top, Up: Top
47 This manual feels abused and neglected because it has almost no content.
50 File: bobot++.info, Node: Configuration, Next: Using the Bot, Prev: Introduction, Up: Top
55 Bobot++ is easy to configure. The configuration file format may be
56 changing in the 2.1 series, so it is not documented for now. See the
57 `examples' directory for an example configuration.
61 * Configuration File Syntax::
62 * Configure File Placement::
65 File: bobot++.info, Node: Configuration File Syntax, Next: Configure File Placement, Prev: Configuration, Up: Configuration
67 Configuration File Syntax
68 =========================
75 File: bobot++.info, Node: bot.conf, Prev: Configuration File Syntax, Up: Configuration File Syntax
80 bot.conf is the main configuration file for a Bobot++. The available
81 configuration variables are listed below in the format "VARIABLE
82 <default-value>: description"
84 * NICKNAME <Bobot>: The nickname of the bot (NICK is an alias for
87 * USERNAME <bobot>: The IRC username of the bot
89 * CMDCHAR <!>: The character that prefixes commands given to the bot
90 (COMMAND is an alias for CMDCHAR)
92 * IRCNAME <I'm a bobot++!>: The IRC name (or 'real name') of the bot
93 (REALNAME is an alias for IRCNAME)
95 * USERLIST <bot.users>: Name of the file where the userlist is stored
97 * SHITLIST <bot.shit>: Name of the file where the shitlist is stored
99 * LOGFILE <$LOGDIR/bot.log>:
103 File: bobot++.info, Node: Configure File Placement, Prev: Configuration File Syntax, Up: Configuration
105 Configuration File Placement
106 ============================
108 Bobot++ will look in `/etc/bobotpp/default/' for its default config if
109 none is specified on the command line. Put the configuration files you
110 want to be loaded by default in this directory. If you are not root or
111 you want to have your own personal configration, put it in
112 `~/.bobotpp/config/default/'.
115 File: bobot++.info, Node: Using the Bot, Next: Scripting, Prev: Configuration, Up: Top
127 File: bobot++.info, Node: User Levels, Prev: Using the Bot, Up: Using the Bot
132 There are five levels that a user may be when interfacing with a bot:
133 NONE, USER, TRUSTED_USER, FRIEND, MASTER. All users default to NONE
134 unless they are changed by a script, the `!adduser' command or the
135 `bot.users' file. NONE is for everyone--very few commands (e.g. help)
136 are available to the users and almost everyone should be this level. A
137 USER can execute many of the bot commands, but can't use masks on kicks
138 and bans. A TRUSTED user can everything a USER can do, but can also use
139 masks on kicks and bans. A FRIEND can do everything except for stopping
140 the bot (be careful who you give this to!). The MASTER level is for the
141 bot's owner (probably you) and can do _everything_ to the bot. Be
142 _very_ careful if you give MASTER level access to anyone else. You
143 cannot use this symbolic levels with the `!adduser' command. See
144 (FIXME: ref) for the numbers you must use with `!adduser'.
147 File: bobot++.info, Node: Scripting, Next: Concept Index, Prev: Using the Bot, Up: Top
152 Bobot++'s most powerful feature is its scripting system. You write
153 scripts using Guile Scheme. This manual does not cover how to use Guile
154 or how to learn Scheme. *Note Guile Reference Manual: (guile)Top, for
155 the Guile reference manual and
156 <http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme.html> for a
157 good tutorial on Scheme.
159 Note that in previous versions the scripting commands where in the
160 form `bot-FUNCTION'. They are now in the form `bot:FUNCTION'. The old
161 names are still available, but are deprecated and will be removed in
162 Bobot++ 2.4. The command `perl -pi -e ``s/bot-/bot:/g'' YOUR-FILES'
163 should be enough to convert your code to use the new functions.
167 * Adding New Commands::
169 * Scheme User Levels::
171 * Misc Scripting Stuff::
174 File: bobot++.info, Node: Adding New Commands, Next: Hooks, Prev: Scripting, Up: Scripting
179 Adding a new command is simple. To register a new command use
180 `bot:addcommand'. The prototype for `bot:addcommand' is
181 `(bot:addcommand name func needs-channel? num-of-args min-level)'. The
182 `name' is a string representing the name of the command being added.
183 `func' is a function accepting `num-of-args' arguments.
184 `needs-channel?' is a bool that is true if the function needs the
185 channel name as its first arg, and false otherwise. `num-of-args' is
186 the number of args `func' will take and must be within zero (0) and
187 twenty (20). `min-level' is one of the *Note Scheme User Levels::. A
188 user must be at least a `min-level' user to use the new command. None
189 of the arguments are guaranteed to be passed; if they aren't they are
190 set to the empty string `""'. An example of a new command would be:
192 (define (hello channel name)
193 (if (string=? name "")
194 (bot:say channel "Hello world!")
195 (bot:say channel (string-append "Hello " name "!")))
197 (bot:addcommand "hello" hello #t 2 0)
199 This will display "Hello World!" if called as `!hello' and "Hello
200 World `USER'" if called as `!hello USER'.
203 File: bobot++.info, Node: Hooks, Next: Scheme User Levels, Prev: Adding New Commands, Up: Scripting
208 Hooks are a powerful feature of Bobot++. Hooks are a hybrid of ircII
209 and tiny fugue (a MUD bot) hooks with a little bit of extra stuff added
210 in. The basic idea of a hook if that you match a text against regular
211 expression and call a function if text in a message matches that regex.
212 The different types of hooks provided by Bobot++ correspond to the
213 different classes of messages that Bobot++ can recieve. A Hook also has
214 several properties, including its priority and whether or not it is a
215 fallthrough hook. Higher priority hooks are executed before lower
216 priority hooks and fallthrough hooks are executed before
217 non-fallthrough hooks of the same priority. A fallthrough hook can
218 match and processing of hooks will continue; as soon as the first
219 non-fallthrough hooks matches processing of hooks stops.
227 File: bobot++.info, Node: Creating a Hook, Next: Hook Types, Prev: Hooks, Up: Hooks
232 To add a new hook you use the function `bot:addhook'. `bot:addhook' is
233 prototyped as `(bot:addhook type regex function pri fall name)'. `type'
234 specifies the type of hook (the types of hooks are listed in *Note Hook
235 Types::). `regex' is a standard regular expression. If `regex' is
236 matched, `function' will be called. `function' will take a different
237 number of args depending on the hook type. `pri' specifies the priority
238 of the hook--higher priority hooks are executed first. This argument is
239 optional and defaults to `0'. `fall' is `#t' if the hook is a
240 fallthrough hook and `#f' is the hook is not a fallthrough hook. This
241 arg is also optional and default to `#t'. `name' is the optional name
242 of the hook that defaults to "DEFAULT". If you set the name then you
243 can have more than one hook that matches the same regexp, as long as
244 they have the same name. E.g. in a log script you could have the
245 regexps for the log function all be `".*"' and set their names to
246 `"log"' to avoid a conflict with other hooks.
249 File: bobot++.info, Node: Hook Types, Prev: Creating a Hook, Up: Hooks
254 Here is a list of the various hooks are notes on each one. The general
257 * `hooks/name' (this is the Scheme variable name of the hook)
258 - Description of the hook
269 That said, here is the list of available hooks: FIXME: write docs
272 - This hook is triggered when someone performs an action.
275 - FROM: this is the address of the person that performed
276 the action in the form `NICK ! USER @ HOST' (without the
279 - TO: This is the target of the action, which is either a
280 channel or the Bot's nick.
282 - ACTION: This is the text of the action. E.g. if someone
283 did `* foobar does baz', then ACTION would be the string
287 - Description of the hook
293 - Description of the hook
299 - Description of the hook
305 - Description of the hook
311 - Description of the hook
317 - Description of the hook
323 - Description of the hook
329 - Description of the hook
335 - Description of the hook
341 - Description of the hook
347 - Description of the hook
353 - Description of the hook
359 - Description of the hook
365 - Description of the hook
370 * `hooks/public-notice'
371 - Description of the hook
377 - Description of the hook
383 - Description of the hook
389 - Description of the hook
395 - This hook is triggered when a user begins a DCC CHAT with the
399 - FROM: This is the user's address in the form
402 * `hooks/dcc/message'
403 - This hook is triggered when a user sends a message to the bot
407 - FROM: This is the user's address in the form
410 - MESSAGE: This is the message the user sent to the bot.
413 File: bobot++.info, Node: Scheme User Levels, Next: Sending Messages, Prev: Hooks, Up: Scripting
418 There are five levels that a user may be when interfacing with a bot:
419 NONE, USER, TRUSTED_USER, FRIEND, MASTER. The Scheme variables for the
420 user levels are `bot:user-none', `bot:user-user', `bot:user-trusted',
421 `bot:user-friend', and `bot:user-master'. See *Note User Levels:: for
422 more information on User Levels.
424 When adding a new command, think about who should be able to use it.
425 Is your command a general purpose command that helps the channel (e.g.
426 `!seen') that everyone should be able to use? Or is it something that
427 should be restricted? See *Note User Levels:: for information on what
428 level users can do what with the built in bot commands and think about
429 what level a user your command is targetted towards. You must be _very_
430 careful when giving new commands to lower level users because you can
431 do basically everything the bot can do with a script. As the scripting
432 interface becomes more powerful, you must think more about what users
433 can use new commands you add.
436 File: bobot++.info, Node: Sending Messages, Next: Misc Scripting Stuff, Prev: Scheme User Levels, Up: Scripting
441 There are several types of messages you can send with Bobot++ from
442 scripts. There is the simple, but rather limited, `bot:say',
443 `bot:action' and `bot:msg', and the more powerful, but lower level,
444 `bot:send-MESSAGE' functions. Most bots will probably only need the
445 higher level functions, but for the sake of why-not Bobot++ lets you
446 use the lower level functions (in progress).
450 * High Level Message Functions::
451 * Low Level Message Functions::
454 File: bobot++.info, Node: High Level Message Functions, Next: Low Level Message Functions, Prev: Sending Messages, Up: Sending Messages
456 "High Level" Message Functions
457 ------------------------------
462 File: bobot++.info, Node: Low Level Message Functions, Prev: High Level Message Functions, Up: Sending Messages
464 "Low Level" Message Functions
465 -----------------------------
467 The "Low Level" messaging functions allow you to do things like send
468 CTCP messages. You probably want to read rfc 2812 and the CTCP spec
469 before using these. If you have no idea what these do, read rfc 2812
470 (IRC Client Protocol) and CTCP spec. These functions all return
471 `*unspecified*' always, so don't use the return value for anything.
473 * `bot:send-CTCP to command message' `to' is the target of your CTCP
474 message, `command' is the CTCP command, and `message' is the
475 message (or arguments) of the command. Make sure to
476 `bot:ctcp-quote' the message!
480 File: bobot++.info, Node: Misc Scripting Stuff, Prev: Sending Messages, Up: Scripting
482 Misc. Scripting Stuff
483 =====================
485 These are a few useful things that I thought people writing scripts
488 If you want to execute code when the bot exits, just do `add-hook!
489 bot:exit-hook THUNK' where THUNK is an argumentless procedure (a
490 thunk). When the bot exits your thunk will be called.
493 File: bobot++.info, Node: Concept Index, Next: Function Index, Prev: Scripting, Up: Top
500 * Background on Hooks: Hooks.
503 File: bobot++.info, Node: Function Index, Next: Variable Index, Prev: Concept Index, Up: Top
510 * addcommand: Adding New Commands.
511 * addhook: Creating a Hook.
514 File: bobot++.info, Node: Variable Index, Prev: Function Index, Up: Top
521 * exit-hook: Misc Scripting Stuff.
522 * hooks/action: Hook Types.
523 * hooks/ctcp: Hook Types.
524 * hooks/ctcp-reply: Hook Types.
525 * hooks/dcc/begin: Hook Types.
526 * hooks/dcc/message: Hook Types.
527 * hooks/disconnect: Hook Types.
528 * hooks/flood: Hook Types.
529 * hooks/invite: Hook Types.
530 * hooks/join: Hook Types.
531 * hooks/kick: Hook Types.
532 * hooks/message: Hook Types.
533 * hooks/mode: Hook Types.
534 * hooks/nickname: Hook Types.
535 * hooks/notice: Hook Types.
536 * hooks/part: Hook Types.
537 * hooks/public: Hook Types.
538 * hooks/public-notice: Hook Types.
539 * hooks/raw: Hook Types.
540 * hooks/signoff: Hook Types.
541 * hooks/timer: Hook Types.
542 * hooks/topic: Hook Types.
543 * user-friend: Scheme User Levels.
544 * user-master: Scheme User Levels.
545 * user-none: Scheme User Levels.
546 * user-trusted: Scheme User Levels.
547 * user-user: Scheme User Levels.
553 Node: Introduction
\7f1246
554 Node: Configuration
\7f1434
555 Node: Configuration File Syntax
\7f1817
556 Node: bot.conf
\7f2024
557 Node: Configure File Placement
\7f2856
558 Node: Using the Bot
\7f3327
559 Node: User Levels
\7f3498
560 Node: Scripting
\7f4499
561 Node: Adding New Commands
\7f5404
563 Node: Creating a Hook
\7f7639
564 Node: Hook Types
\7f8775
565 Node: Scheme User Levels
\7f12246
566 Node: Sending Messages
\7f13372
567 Node: High Level Message Functions
\7f13980
568 Node: Low Level Message Functions
\7f14191
569 Node: Misc Scripting Stuff
\7f14941
570 Node: Concept Index
\7f15357
571 Node: Function Index
\7f15539
572 Node: Variable Index
\7f15800