[project @ 2002-07-15 21:01:51 by unknown_lamer]
[clinton/bobotpp.git] / bobot++.texinfo
1 \input texinfo @c -*- texinfo -*-
2 @c %**start of header
3 @setfilename bobot++.info
4 @settitle Bobot++: A Schemeable IRC Bot
5 @setchapternewpage on
6 @c %**end of header
7
8 @ifinfo
9 This file documents Bobot++ by Clinton Ebadi and Etienne Bernard
10 (original author, no longer works on program).
11
12 Copyright 2002 Clinton Ebadi
13
14 Permission is granted to copy, distribute and/or modify this document
15 under the terms of the GNU Free Documentation License, Version 1.1 or
16 any later version published by the Free Software Foundation; with no
17 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
18 Texts.
19
20 @end ifinfo
21
22 @titlepage
23 @title Bobot++: A Schemeable IRC Bot
24 @author Clinton Ebadi
25
26 @page
27 @vskip Opt plus 1filll
28 Copyright @copyright{} 2002 Clinton Ebadi
29
30 Permission is granted to copy, distribute and/or modify this document
31 under the terms of the GNU Free Documentation License, Version 1.1 or
32 any later version published by the Free Software Foundation; with no
33 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
34 Texts.
35
36 @end titlepage
37
38 @node Top, Introduction, (dir), (dir)
39 @comment node-name, next, previous, up
40
41 @ifinfo
42 This document describes Bobot++ by Clinton Ebadi and Etienne Bernard
43 (original author, no longer works on program).
44
45 This document applies to version 2.1.0 of the program named
46 Bobot++
47
48 Copyright 2002 Clinton Ebadi
49
50 Permission is granted to copy, distribute and/or modify this document
51 under the terms of the GNU Free Documentation License, Version 1.1 or
52 any later version published by the Free Software Foundation; with no
53 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
54 Texts.
55 @end ifinfo
56
57 @menu
58 * Introduction::
59 * Configuration::
60 * Using the Bot::
61 * Scripting::
62 * Concept Index::
63 * Function Index::
64 * Variable Index::
65 @end menu
66
67 @node Introduction, Configuration, Top, Top
68 @chapter Introduction
69
70 This manual feels abused and neglected because it has almost no
71 content.
72
73 @node Configuration, Using the Bot, Introduction, Top
74 @chapter Configuration
75
76 Bobot++ is easy to configure. The configuration file format may be
77 changing in the 2.1 series, so it is not documented for now. See the
78 @file{examples} directory for an example configuration.
79
80 @menu
81 * Configuration File Syntax::
82 * Configure File Placement::
83 @end menu
84
85 @node Configuration File Syntax, Configure File Placement, Configuration, Configuration
86 @section Configuration File Syntax
87
88 Not here yet.
89
90 @node Configure File Placement, , Configuration File Syntax, Configuration
91 @section Configuration File Placement
92
93 Bobot++ will look in @file{/etc/bobotpp/default/} for its default
94 config if none is specified on the command line. Put the configuration
95 files you want to be loaded by default in this directory. If you are
96 not root or you want to have your own personal configration, put it in
97 @file{~/.bobotpp/config/default/}.
98
99 @node Using the Bot, Scripting, Configuration, Top
100 @chapter Using Bobot++
101
102 FIXME: stuff here...
103
104 @menu
105 * User Levels::
106 @end menu
107
108 @node User Levels, , Using the Bot, Using the Bot
109 @section User Levels
110
111 There are five levels that a user may be when interfacing with a bot:
112 @var{none}, @var{user}, @var{trusted_user}, @var{friend},
113 @var{master}. All users default to @var{none} unless they are changed
114 by a script, the @code{!adduser} command or the @file{bot.users}
115 file. @var{none} is for everyone---very few commands (e.g. help) are
116 available to the users and almost everyone should be this
117 level. A @var{user} can execute many of the bot commands, but can't
118 use masks on kicks and bans. A @var{trusted} user can everything a
119 @var{user} can do, but can also use masks on kicks and bans. A
120 @var{friend} can do everything except for stopping the bot (be
121 careful who you give this to!). The @var{master} level is for the
122 bot's owner (probably you) and can do @emph{everything} to the bot. Be
123 @emph{very} careful if you give @var{master} level access to anyone
124 else. You cannot use this symbolic levels with the @code{!adduser}
125 command. See (FIXME: ref) for the numbers you must use with
126 @code{!adduser}.
127
128 @node Scripting, Concept Index, Using the Bot, Top
129 @chapter Scripting
130
131 Bobot++'s most powerful feature is its scripting system. You write
132 scripts using Guile Scheme. This manual does not cover how to use
133 Guile or how to learn Scheme. @xref{Top, , Guile Reference Manual,
134 guile, The Guile Reference Manual}, for the Guile reference manual and
135 @url{http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme.html} for
136 a good tutorial on Scheme.
137
138 Note that in previous versions the scripting commands where in the
139 form @code{bot-@var{function}}. They are now in the form
140 @code{bot:@var{function}}. The old names are still available, but are
141 deprecated and will be removed in Bobot++ 2.4. The command
142 @command{perl -pi -e ``s/bot-/bot:/g'' @var{your-files}} should be enough to
143 convert your code to use the new functions.
144
145 @menu
146 * Adding New Commands::
147 * Hooks::
148 * Scheme User Levels::
149 * Sending Messages::
150 @end menu
151
152 @node Adding New Commands, Hooks, Scripting, Scripting
153 @section Adding New Commands
154
155 @findex addcommand
156 Adding a new command is simple. To register a new command use
157 @code{bot:addcommand}. The prototype for @code{bot:addcommand} is
158 @code{(bot:addcommand name func needs-channel? num-of-args
159 min-level)}. The @code{name} is a string representing the name of the
160 command being added. @code{func} is a function accepting
161 @code{num-of-args} arguments. @code{needs-channel?} is a bool that is
162 true if the function needs the channel name as its first arg, and
163 false otherwise. @code{num-of-args} is the number of args @code{func}
164 will take and must be within zero (0) and twenty
165 (20). @code{min-level} is one of the @ref{Scheme User Levels}. A user must be
166 at least a @code{min-level} user to use the new command. None of the
167 arguments are guaranteed to be passed; if they aren't they are set to
168 the empty string @code{""}. An example of a new command would be:
169 @verb{|
170 (define (hello channel name)
171 (if (string=? name "")}@*
172 (bot:say channel "Hello world!")
173 (bot:say channel (string-append "Hello " name "!")))
174
175 (bot:addcommand "hello" hello #t 2 0)
176 |}
177 This will display ``Hello World!'' if called as @kbd{!hello} and
178 ``Hello World @code{USER}'' if called as @kbd{!hello @var{USER}}.
179
180 @node Hooks, Scheme User Levels, Adding New Commands, Scripting
181 @section Hooks
182
183 @cindex Background on Hooks
184 Hooks are a powerful feature of Bobot++. Hooks are a hybrid of ircII
185 hooks and tiny fugue (a MUD bot) hooks. The basic idea of a hook if
186 that you match a text against regular expression and call a function
187 if text in a message matches that regex. The different types of hooks
188 provided by Bobot++ correspond to the different classes of messages
189 that Bobot++ can recieve. A Hook also has several properties,
190 including its priority and whether or not it is a fallthrough
191 hook. Higher priority hooks are executed before lower priority hooks
192 and fallthrough hooks are executed before non-fallthrough hooks. A
193 fallthrough hook can match and processing of hooks will continue; as
194 soon as the first non-fallthrough hooks matches processing of hooks
195 stops.
196
197 @menu
198 * Creating a Hook::
199 * Hook Types::
200 @end menu
201
202 @node Creating a Hook, Hook Types, Hooks, Hooks
203 @subsection Creating a Hook
204
205 @findex addhook
206 To add a new hook you use the function
207 @code{bot:addhook}. @code{bot:addhook} is prototyped as
208 @code{(bot:addhook type regex function pri fall)}. @code{type}
209 specifies the type of hook (the types of hooks are listed in @ref{Hook
210 Types}). @code{regex} is a standard regular expression. If
211 @code{regex} is matched, @code{function} will be
212 called. @code{function} will take a different number of args depending
213 on the hook type. @code{pri} specifies the priority of the
214 hook---higher priority hooks are executed first. This argument is
215 optional and defaults to @code{0}. @code{fall} is @code{#t} if the
216 hook is a fallthrough hook and @code{#f} is the hook is not a
217 fallthrough hook. This arg is also optional and default to @code{#t}.
218
219 @node Hook Types, , Creating a Hook, Hooks
220 @subsection Hook Types
221
222 Here is a list of the various hooks are notes on each one. The general
223 format of a hook is:
224
225 @itemize @bullet
226 @item
227 @code{hooks/name} (this is the Scheme variable name of the hook)
228 @itemize @minus
229 @item
230 Description of the hook
231 @item
232 # of args
233 @itemize @minus
234 @item
235 @code{arg1}: desc
236 @item
237 @code{arg2}: desc
238 @item
239 ...
240 @item
241 @code{argN}: desc
242 @end itemize
243 @end itemize
244 @end itemize
245
246 That said, here is the list of available hooks:
247 FIXME: write docs
248
249 @itemize @bullet
250
251 @item
252 @vindex hooks/action
253 @code{hooks/action}
254 @itemize @minus
255 @item
256 Description of the hook
257 @item
258 # of args
259 @itemize @minus
260 @item
261 @code{arg1}: desc
262 @end itemize
263 @end itemize
264
265 @item
266 @vindex hooks/nickname
267 @code{hooks/nickname}
268 @itemize @minus
269 @item
270 Description of the hook
271 @item
272 # of args
273 @itemize @minus
274 @item
275 @code{arg1}: desc
276 @end itemize
277 @end itemize
278
279 @item
280 @vindex hooks/signoff
281 @code{hooks/signoff}
282 @itemize @minus
283 @item
284 Description of the hook
285 @item
286 # of args
287 @itemize @minus
288 @item
289 @code{arg1}: desc
290 @end itemize
291 @end itemize
292
293 @item
294 @vindex hooks/ctcp
295 @code{hooks/ctcp}
296 @itemize @minus
297 @item
298 Description of the hook
299 @item
300 # of args
301 @itemize @minus
302 @item
303 @code{arg1}: desc
304 @end itemize
305 @end itemize
306
307 @item
308 @vindex hooks/ctcp-reply
309 @code{hooks/ctcp-reply}
310 @itemize @minus
311 @item
312 Description of the hook
313 @item
314 # of args
315 @itemize @minus
316 @item
317 @code{arg1}: desc
318 @end itemize
319 @end itemize
320
321 @item
322 @vindex hooks/disconnect
323 @code{hooks/disconnect}
324 @itemize @minus
325 @item
326 Description of the hook
327 @item
328 # of args
329 @itemize @minus
330 @item
331 @code{arg1}: desc
332 @end itemize
333 @end itemize
334
335 @item
336 @vindex hooks/flood
337 @code{hooks/flood}
338 @itemize @minus
339 @item
340 Description of the hook
341 @item
342 # of args
343 @itemize @minus
344 @item
345 @code{arg1}: desc
346 @end itemize
347 @end itemize
348
349 @item
350 @vindex hooks/invite
351 @code{hooks/invite}
352 @itemize @minus
353 @item
354 Description of the hook
355 @item
356 # of args
357 @itemize @minus
358 @item
359 @code{arg1}: desc
360 @end itemize
361 @end itemize
362
363 @item
364 @vindex hooks/join
365 @code{hooks/join}
366 @itemize @minus
367 @item
368 Description of the hook
369 @item
370 # of args
371 @itemize @minus
372 @item
373 @code{arg1}: desc
374 @end itemize
375 @end itemize
376
377 @item
378 @vindex hooks/kick
379 @code{hooks/kick}
380 @itemize @minus
381 @item
382 Description of the hook
383 @item
384 # of args
385 @itemize @minus
386 @item
387 @code{arg1}: desc
388 @end itemize
389 @end itemize
390
391 @item
392 @vindex hooks/part
393 @code{hooks/part}
394 @itemize @minus
395 @item
396 Description of the hook
397 @item
398 # of args
399 @itemize @minus
400 @item
401 @code{arg1}: desc
402 @end itemize
403 @end itemize
404
405 @item
406 @vindex hooks/mode
407 @code{hooks/mode}
408 @itemize @minus
409 @item
410 Description of the hook
411 @item
412 # of args
413 @itemize @minus
414 @item
415 @code{arg1}: desc
416 @end itemize
417 @end itemize
418
419 @item
420 @vindex hooks/message
421 @code{hooks/message}
422 @itemize @minus
423 @item
424 Description of the hook
425 @item
426 # of args
427 @itemize @minus
428 @item
429 @code{arg1}: desc
430 @end itemize
431 @end itemize
432
433 @item
434 @vindex hooks/notice
435 @code{hooks/notice}
436 @itemize @minus
437 @item
438 Description of the hook
439 @item
440 # of args
441 @itemize @minus
442 @item
443 @code{arg1}: desc
444 @end itemize
445 @end itemize
446
447 @item
448 @vindex hooks/public
449 @code{hooks/public}
450 @itemize @minus
451 @item
452 Description of the hook
453 @item
454 # of args
455 @itemize @minus
456 @item
457 @code{arg1}: desc
458 @end itemize
459 @end itemize
460
461 @item
462 @vindex hooks/public-notice
463 @code{hooks/public-notice}
464 @itemize @minus
465 @item
466 Description of the hook
467 @item
468 # of args
469 @itemize @minus
470 @item
471 @code{arg1}: desc
472 @end itemize
473 @end itemize
474
475 @item
476 @vindex hooks/raw
477 @code{hooks/raw}
478 @itemize @minus
479 @item
480 Description of the hook
481 @item
482 # of args
483 @itemize @minus
484 @item
485 @code{arg1}: desc
486 @end itemize
487 @end itemize
488
489 @item
490 @vindex hooks/timer
491 @code{hooks/timer}
492 @itemize @minus
493 @item
494 Description of the hook
495 @item
496 # of args
497 @itemize @minus
498 @item
499 @code{arg1}: desc
500 @end itemize
501 @end itemize
502
503 @item
504 @vindex hooks/topic
505 @code{hooks/topic}
506 @itemize @minus
507 @item
508 Description of the hook
509 @item
510 # of args
511 @itemize @minus
512 @item
513 @code{arg1}: desc
514 @end itemize
515 @end itemize
516
517 @end itemize
518
519
520 @node Scheme User Levels, Sending Messages, Hooks, Scripting
521 @section Scheme User Levels
522
523 @vindex user-none
524 @vindex user-user
525 @vindex user-trusted
526 @vindex user-friend
527 @vindex user-master
528 There are five levels that a user may be when interfacing with a bot:
529 @var{none}, @var{user}, @var{trusted_user}, @var{friend},
530 @var{master}. The Scheme variables for the user levels are
531 @code{bot:user-none}, @code{bot:user-user}, @code{bot:user-trusted},
532 @code{bot:user-friend}, and @code{bot:user-master}. See @ref{User
533 Levels} for more information on User Levels.
534
535 When adding a new command, think about who should be able to use
536 it. Is your command a general purpose command that helps the channel
537 (e.g. @code{!seen}) that everyone should be able to use? Or is it
538 something that should be restricted? See @ref{User Levels} for
539 information on what level users can do what with the built in bot
540 commands and think about what level a user your command is targetted
541 towards. You must be @emph{very} careful when giving new commands to
542 lower level users because you can do basically everything the bot can
543 do with a script. As the scripting interface becomes more powerful,
544 you must think more about what users can use new commands you add.
545
546 @node Sending Messages, , Scheme User Levels, Scripting
547 @section Sending Messages
548
549 There are several types of messages you can send with Bobot++ from
550 scripts. There is the simple, but rather limited, @code{bot:say},
551 @code{bot:action} and @code{bot:msg}, and
552 the more powerful, but lower level, @code{bot:send-MESSAGE}
553 functions. Most bots will probably only need the higher level
554 functions, but for the sake of why-not Bobot++ lets you use the lower
555 level functions.
556
557 @menu
558 * High Level Message Functions::
559 * Low Level Message Functions::
560 @end menu
561
562 @node High Level Message Functions, Low Level Message Functions, Sending Messages, Sending Messages
563 @subsection ``High Level'' Message Functions
564
565 ...
566
567 @node Low Level Message Functions, , High Level Message Functions, Sending Messages
568 @subsection ``Low Level'' Message Functions
569
570 The ``Low Level'' messaging functions allow you to do things like send
571 CTCP messages. You probably want to read rfc 2812 and the CTCP spec
572 before using these. If you have no idea what these do, read rfc 2812
573 (IRC Client Protocol) and CTCP spec. These functions all return
574 @code{*unspecified*} always, so don't use the return value for anything.
575
576 @itemize @bullet
577
578 @item @code{bot:send-CTCP to command message}
579 @code{to} is the target of your CTCP message, @code{command} is the
580 CTCP command, and @code{message} is the message (or arguments) of the
581 command. Make sure to @code{bot:ctcp-quote} the message!
582
583 @end itemize
584
585 @node Concept Index, Function Index, Scripting, Top
586 @unnumbered Concept Index
587 @printindex cp
588
589 @node Function Index, Variable Index, Concept Index, Top
590 @unnumbered Function Index
591 @printindex fn
592
593 @node Variable Index, , Function Index, Top
594 @unnumbered Variable Index
595 @printindex vr