c8f13c06 |
1 | input texinfo @c -*- texinfo -*- |
2e20c3e1 |
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 | |
c7d9fb19 |
12 | Copyright 2002,2004 Clinton Ebadi |
2e20c3e1 |
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 |
4edefeb6 |
27 | @vskip O plus 1filll |
c7d9fb19 |
28 | Copyright @copyright{} 2002,2004 Clinton Ebadi |
2e20c3e1 |
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 | |
c7d9fb19 |
45 | This document applies to version 2.1.5 of the program named |
2e20c3e1 |
46 | Bobot++ |
439869bf |
47 | |
c7d9fb19 |
48 | Copyright 2002,2004 Clinton Ebadi |
439869bf |
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. |
2e20c3e1 |
55 | @end ifinfo |
56 | |
57 | @menu |
58 | * Introduction:: |
31433d27 |
59 | * Configuration:: |
e07b6b46 |
60 | * Using the Bot:: |
31433d27 |
61 | * Scripting:: |
62 | * Concept Index:: |
63 | * Function Index:: |
64 | * Variable Index:: |
c7d9fb19 |
65 | |
66 | @detailmenu |
67 | --- The Detailed Node Listing --- |
68 | |
69 | Configuration |
70 | |
71 | * Configuration Files:: |
72 | * Configuration File Placement:: |
73 | |
74 | Configuration Files |
75 | |
76 | * bot.conf:: |
c8f13c06 |
77 | * bot.users:: |
c7d9fb19 |
78 | |
79 | bot.conf |
80 | |
81 | * server syntax:: |
82 | * channel syntax:: |
83 | |
84 | Using Bobot++ |
85 | |
86 | * User Levels:: |
c8f13c06 |
87 | * Protection:: |
88 | * Automatic Op:: |
c7d9fb19 |
89 | |
90 | Scripting |
91 | |
92 | * Adding New Commands:: |
93 | * Hooks:: |
94 | * Scheme User Levels:: |
95 | * Sending Messages:: |
96 | * Misc Scripting Stuff:: |
97 | |
98 | Hooks |
99 | |
100 | * Creating a Hook:: |
101 | * Hook Types:: |
102 | |
103 | Sending Messages |
104 | |
105 | * High Level Message Functions:: |
106 | * Low Level Message Functions:: |
107 | |
108 | @end detailmenu |
2e20c3e1 |
109 | @end menu |
110 | |
31433d27 |
111 | @node Introduction, Configuration, Top, Top |
2e20c3e1 |
112 | @chapter Introduction |
113 | |
31433d27 |
114 | This manual feels abused and neglected because it has almost no |
115 | content. |
116 | |
e07b6b46 |
117 | @node Configuration, Using the Bot, Introduction, Top |
31433d27 |
118 | @chapter Configuration |
119 | |
c8f13c06 |
120 | Bobot++ is easy to configure. See the @file{examples} directory for an |
121 | example configuration. |
31433d27 |
122 | |
123 | @menu |
c7d9fb19 |
124 | * Configuration Files:: |
125 | * Configuration File Placement:: |
31433d27 |
126 | @end menu |
127 | |
c7d9fb19 |
128 | @node Configuration Files, Configuration File Placement, Configuration, Configuration |
129 | @section Configuration Files |
31433d27 |
130 | |
e171dcce |
131 | @menu |
132 | * bot.conf:: |
c8f13c06 |
133 | * bot.users:: |
e171dcce |
134 | @end menu |
135 | |
c8f13c06 |
136 | @node bot.conf, bot.users, Configuration Files, Configuration Files |
e171dcce |
137 | @subsection bot.conf |
138 | |
c8f13c06 |
139 | @menu |
140 | * server syntax:: |
141 | * channel syntax:: |
142 | @end menu |
143 | |
c7d9fb19 |
144 | @file{bot.conf} contains key value pairs separated by @code{=}. |
145 | |
146 | @code{<key> = <value>} |
147 | |
148 | Comments are started with a @code{#} and cause the entire line to be |
149 | ignored. @emph{Note that this only works when the @code{#} is the first |
150 | character of the line}. |
151 | |
e171dcce |
152 | bot.conf is the main configuration file for a Bobot++. The available |
153 | configuration variables are listed below in the format ``@var{variable} |
154 | <default-value>: description'' |
155 | |
156 | @itemize @bullet |
157 | |
158 | @item @var{nickname} <Bobot>: The nickname of the bot (@var{nick} is an |
159 | alias for @var{nickname}) |
160 | @item @var{username} <bobot>: The IRC username of the bot |
161 | @item @var{cmdchar} <!>: The character that prefixes commands given to |
162 | the bot (@var{command} is an alias for @var{cmdchar}) |
163 | @item @var{ircname} <I'm a bobot++!>: The IRC name (or 'real name') of |
164 | the bot (@var{realname} is an alias for @var{ircname}) |
165 | @item @var{userlist} <bot.users>: Name of the file where the userlist is |
166 | stored |
167 | @item @var{shitlist} <bot.shit>: Name of the file where the shitlist is |
168 | stored |
c7d9fb19 |
169 | @item @var{logfile} <$LOGDIR/bot.log>: Location of the bot logfile |
170 | (set this to @file{/dev/null} to disable logging). |
171 | @item @var{server} <None>: This specifies the server to connect |
172 | to. Note that this has a special syntax. |
173 | @item @var{channel} <None>: This specifies a channel the bot will join |
174 | when it starts up. This also has a special syntax. |
e171dcce |
175 | |
176 | @end itemize |
31433d27 |
177 | |
c7d9fb19 |
178 | @node server syntax, channel syntax, bot.conf, bot.conf |
179 | @subsubsection server syntax |
180 | |
181 | @var{server} = @var{server_name} [@var{port} [@var{password}]] |
182 | |
183 | This will make Bobot++ attempt to connect to @var{server_name} on port |
184 | @var{port} with the password @var{password}. @var{server_name} should |
185 | be the address of the server. @var{port} and @var{password} are |
186 | optional. You may use more than one server line; Bobot++ will attempt |
187 | to connect to the first one and, if it fails, will connect to the next |
188 | one in the list. There is also a command to cause the bot to cycle |
189 | servers. At the present time Bobot++ cannot connect to more than one |
190 | server at a time. This is a planned feature of 3.0 (which is a very |
191 | long way away; the current structure of the program would make it very |
192 | difficult to add support for connecting to multiple servers at a time |
193 | in a usable manner). |
194 | |
195 | @node channel syntax, , server syntax, bot.conf |
196 | @subsubsection channel syntax |
197 | |
198 | @var{channel} = |
199 | @var{name}:@var{initial_modes}:@var{modes_to_keep}:@var{channel_key} |
200 | |
201 | You may have any number of channel lines. When Bobot++ starts it will |
202 | attempt to join and gain ops in every channel listed. It will join |
203 | @var{name} and set the channel modes to @var{initial_modes} |
204 | (e.g. ``nt'') if it is able to gain operator status. It will then |
205 | maintain @var{modes_to_keep}. If the channel requires a key to enter |
206 | simply set @var{channel_key}. Every argument except for @var{name} is |
207 | optional. |
208 | |
209 | A few example lines: |
210 | |
211 | @code{@var{channel} = #foo:nt:nt:bar} |
212 | |
213 | The bot will join @code{#foo} with the channel key @code{bar} and will |
214 | then maintain the modes @code{nt}. |
215 | |
216 | @code{@var{channel} = #bar:::} |
217 | |
218 | The bot will join @code{#bar} and will not set any modes nor will it |
219 | attempt to maintain any modes. |
220 | |
c8f13c06 |
221 | @node bot.users, , bot.conf, Configuration Files |
222 | @subsection bot.users |
223 | |
224 | @file{bot.users} is the default file name of the userlist. It may be |
225 | changed in @file{bot.conf}. The file contains lines with the format: |
226 | |
227 | @samp{@var{mask}:@var{channel}:@var{level}:@var{protection}:@var{auto-op}} |
228 | |
229 | @itemize |
230 | |
231 | @item @var{mask} is the host mask |
232 | (e.g. @samp{*!*username@*.domain.com}) of the user |
233 | |
234 | @item @var{channel} is a channel mask of the channels that the user |
235 | has priviliges to use the bot in (e.g. @samp{*} for all channels, |
236 | @samp{#*} for all non-local channel, @samp{#foo*} for all channels |
237 | starting with ``foo,'' @samp{#bar} for channel ``#bar'' only, etc.) |
238 | |
239 | @item @var{level} is the user level of the user (@ref{User Levels}). |
240 | |
241 | @item @var{protection} is the protection level of the user |
242 | (@ref{Protection}). |
243 | |
244 | @item @var{auto-op} is set to control whether a user is automatically |
245 | given operator priviliges on channel entry (@ref{Automatic Op}). |
246 | |
247 | @end itemize |
248 | |
c7d9fb19 |
249 | @node Configuration File Placement, , Configuration Files, Configuration |
ad529fde |
250 | @section Configuration File Placement |
31433d27 |
251 | |
252 | Bobot++ will look in @file{/etc/bobotpp/default/} for its default |
253 | config if none is specified on the command line. Put the configuration |
ad529fde |
254 | files you want to be loaded by default in this directory. If you are |
c8f13c06 |
255 | not root or you want to have your own personal configuration, put it |
256 | in @file{~/.bobotpp/config/default/}. |
31433d27 |
257 | |
e07b6b46 |
258 | @node Using the Bot, Scripting, Configuration, Top |
259 | @chapter Using Bobot++ |
260 | |
261 | FIXME: stuff here... |
262 | |
263 | @menu |
264 | * User Levels:: |
c8f13c06 |
265 | * Protection:: |
266 | * Automatic Op:: |
e07b6b46 |
267 | @end menu |
268 | |
c8f13c06 |
269 | @node User Levels, Protection, Using the Bot, Using the Bot |
e07b6b46 |
270 | @section User Levels |
271 | |
c8f13c06 |
272 | There are several user levels available in Bobot++ to provide gradated |
273 | access to commands. @command{!adduser} and @file{bot.users} use the |
274 | numeric code; Scheme uses the textual name for the level. By default |
275 | (if no catch-all setting is found in @xref{bot.users}.) a user is not |
276 | even a @code{bot:user-none} and cannot execute @strong{any} commands, |
277 | even commands available to @code{bot:user-none}. |
278 | |
279 | @enumerate 0 |
280 | |
281 | @item @code{bot:user-none} - No @strong{built-in} commands may be |
282 | executed @emph{by default} (commands may be added from Scheme that can |
283 | be executed by users of level none and the level required to execute a |
284 | command may be changed from Scheme). |
285 | |
286 | @item @code{bot:user-user} - Will be able to execute most commands but |
287 | not all and cannot use masks on kicks and bans. |
288 | |
289 | @item @code{bot:user-trusted} - For built-ins with a default |
290 | configuration this user has access to the same set of commands as an |
291 | @code{user} but may use masks on kicks and bans. Scheme commands may |
292 | be added which require a user to be of this level. |
293 | |
294 | @item @code{bot:user-friend} - In the default configuration a user who |
295 | is a friend will be able to do everything short of stopping the |
296 | bot. Again, there may be user added commands that require a higher |
297 | user level. |
298 | |
299 | @item @code{bot:user-master} - This is the highest user level and has |
300 | access to every feature of the bot. |
301 | |
302 | @end enumerate |
303 | |
304 | @node Protection, Automatic Op, User Levels, Using the Bot |
305 | @section Protection |
306 | |
307 | A user added via Scheme, the @file{bot.users} file, or |
308 | @command{!adduser} may be protected from being deoped, kicked, or |
309 | banned. There are currently no symbolic levels in Scheme; just use the |
310 | numeric code. |
311 | |
312 | @enumerate 0 |
313 | |
314 | @item No protection |
315 | |
316 | @item No ban. If a user is banned the bot will unban him.. |
317 | |
318 | @item No kick. The user may still be kicked but the bot will kickban |
319 | the user who kicked the protected user. |
320 | |
321 | @item No deop. The bot will ensure that the user always maintains |
322 | operator status. |
323 | |
324 | @end enumerate |
325 | |
326 | @node Automatic Op, , Protection, Using the Bot |
327 | @section Automatic Op |
328 | |
329 | A user may be automatically given operator status upon entering a |
330 | channel. Set the @var{aop} field to ``0'' to disable auto-op or ``1'' |
331 | to enable auto-op. |
e07b6b46 |
332 | |
333 | @node Scripting, Concept Index, Using the Bot, Top |
31433d27 |
334 | @chapter Scripting |
335 | |
336 | Bobot++'s most powerful feature is its scripting system. You write |
337 | scripts using Guile Scheme. This manual does not cover how to use |
ad529fde |
338 | Guile or how to learn Scheme. @xref{Top, , Guile Reference Manual, |
339 | guile, The Guile Reference Manual}, for the Guile reference manual and |
31433d27 |
340 | @url{http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme.html} for |
341 | a good tutorial on Scheme. |
342 | |
439869bf |
343 | Note that in previous versions the scripting commands where in the |
344 | form @code{bot-@var{function}}. They are now in the form |
345 | @code{bot:@var{function}}. The old names are still available, but are |
c8f13c06 |
346 | deprecated and will be removed in Bobot++ 3.0. New commands are only |
347 | available with the @code{bot:} prefix. The command @command{perl -pi |
348 | -e ``s/bot-/bot:/g'' @var{your-files}} should be enough to convert |
349 | your code to use the new functions. |
439869bf |
350 | |
351 | @menu |
352 | * Adding New Commands:: |
353 | * Hooks:: |
e07b6b46 |
354 | * Scheme User Levels:: |
355 | * Sending Messages:: |
91dddabd |
356 | * Misc Scripting Stuff:: |
439869bf |
357 | @end menu |
358 | |
359 | @node Adding New Commands, Hooks, Scripting, Scripting |
360 | @section Adding New Commands |
361 | |
e07b6b46 |
362 | @findex addcommand |
363 | Adding a new command is simple. To register a new command use |
364 | @code{bot:addcommand}. The prototype for @code{bot:addcommand} is |
365 | @code{(bot:addcommand name func needs-channel? num-of-args |
366 | min-level)}. The @code{name} is a string representing the name of the |
367 | command being added. @code{func} is a function accepting |
368 | @code{num-of-args} arguments. @code{needs-channel?} is a bool that is |
369 | true if the function needs the channel name as its first arg, and |
370 | false otherwise. @code{num-of-args} is the number of args @code{func} |
371 | will take and must be within zero (0) and twenty |
372 | (20). @code{min-level} is one of the @ref{Scheme User Levels}. A user must be |
373 | at least a @code{min-level} user to use the new command. None of the |
374 | arguments are guaranteed to be passed; if they aren't they are set to |
375 | the empty string @code{""}. An example of a new command would be: |
fed59248 |
376 | |
377 | @example |
e07b6b46 |
378 | (define (hello channel name) |
fed59248 |
379 | (if (string=? name "") |
e07b6b46 |
380 | (bot:say channel "Hello world!") |
381 | (bot:say channel (string-append "Hello " name "!"))) |
382 | |
383 | (bot:addcommand "hello" hello #t 2 0) |
fed59248 |
384 | @end example |
385 | |
e07b6b46 |
386 | This will display ``Hello World!'' if called as @kbd{!hello} and |
387 | ``Hello World @code{USER}'' if called as @kbd{!hello @var{USER}}. |
388 | |
389 | @node Hooks, Scheme User Levels, Adding New Commands, Scripting |
439869bf |
390 | @section Hooks |
391 | |
e07b6b46 |
392 | @cindex Background on Hooks |
439869bf |
393 | Hooks are a powerful feature of Bobot++. Hooks are a hybrid of ircII |
fed59248 |
394 | and tiny fugue (a MUD bot) hooks with a little bit of extra stuff |
395 | added in. The basic idea of a hook if that you match a text against |
396 | regular expression and call a function if text in a message matches |
397 | that regex. The different types of hooks provided by Bobot++ |
398 | correspond to the different classes of messages that Bobot++ can |
399 | recieve. A Hook also has several properties, including its priority |
400 | and whether or not it is a fallthrough hook. Higher priority hooks are |
401 | executed before lower priority hooks and fallthrough hooks are |
402 | executed before non-fallthrough hooks of the same priority. A |
403 | fallthrough hook can match and processing of hooks will continue; as |
404 | soon as the first non-fallthrough hooks matches processing of hooks |
405 | stops. |
439869bf |
406 | |
407 | @menu |
408 | * Creating a Hook:: |
409 | * Hook Types:: |
410 | @end menu |
411 | |
412 | @node Creating a Hook, Hook Types, Hooks, Hooks |
413 | @subsection Creating a Hook |
414 | |
e07b6b46 |
415 | @findex addhook |
439869bf |
416 | To add a new hook you use the function |
417 | @code{bot:addhook}. @code{bot:addhook} is prototyped as |
fd7440f1 |
418 | @code{(bot:addhook type regex function pri fall name)}. @code{type} |
439869bf |
419 | specifies the type of hook (the types of hooks are listed in @ref{Hook |
420 | Types}). @code{regex} is a standard regular expression. If |
421 | @code{regex} is matched, @code{function} will be |
422 | called. @code{function} will take a different number of args depending |
423 | on the hook type. @code{pri} specifies the priority of the |
e07b6b46 |
424 | hook---higher priority hooks are executed first. This argument is |
439869bf |
425 | optional and defaults to @code{0}. @code{fall} is @code{#t} if the |
426 | hook is a fallthrough hook and @code{#f} is the hook is not a |
fd7440f1 |
427 | fallthrough hook. This arg is also optional and default to |
428 | @code{#t}. @code{name} is the optional name of the hook that defaults |
429 | to ``DEFAULT''. If you set the name then you can have more than one |
430 | hook that matches the same regexp, as long as they have the same |
431 | name. E.g. in a log script you could have the regexps for the log |
432 | function all be @code{".*"} and set their names to @code{"log"} to |
433 | avoid a conflict with other hooks. |
439869bf |
434 | |
435 | @node Hook Types, , Creating a Hook, Hooks |
436 | @subsection Hook Types |
437 | |
438 | Here is a list of the various hooks are notes on each one. The general |
439 | format of a hook is: |
440 | |
441 | @itemize @bullet |
442 | @item |
443 | @code{hooks/name} (this is the Scheme variable name of the hook) |
444 | @itemize @minus |
445 | @item |
446 | Description of the hook |
447 | @item |
fed59248 |
448 | @var{arg1} @var{arg2} ... @var{argn} |
439869bf |
449 | @itemize @minus |
450 | @item |
fed59248 |
451 | @var{arg1}: desc |
439869bf |
452 | @item |
fed59248 |
453 | @var{arg2}: desc |
439869bf |
454 | @item |
455 | ... |
456 | @item |
fed59248 |
457 | @var{argN}: desc |
439869bf |
458 | @end itemize |
459 | @end itemize |
460 | @end itemize |
461 | |
462 | That said, here is the list of available hooks: |
e07b6b46 |
463 | FIXME: write docs |
439869bf |
464 | |
465 | @itemize @bullet |
e07b6b46 |
466 | |
439869bf |
467 | @item |
e07b6b46 |
468 | @vindex hooks/action |
439869bf |
469 | @code{hooks/action} |
470 | @itemize @minus |
471 | @item |
fed59248 |
472 | This hook is triggered when someone performs an action. |
439869bf |
473 | @item |
fed59248 |
474 | @var{from}, @var{to}, @var{action} |
439869bf |
475 | @itemize @minus |
476 | @item |
fed59248 |
477 | @var{from}: this is the address of the person that performed the |
0b7a49e2 |
478 | action in the form @samp{@var{nick} ! @var{user} @@ @var{host}} |
fed59248 |
479 | (without the spaces). |
480 | @item |
481 | @var{to}: This is the target of the action, which is either a channel |
482 | or the Bot's nick. |
483 | @item |
484 | @var{action}: This is the text of the action. E.g. if someone did |
485 | @samp{* foobar does baz}, then @var{action} would be the string |
486 | @code{"does baz"}. |
439869bf |
487 | @end itemize |
488 | @end itemize |
489 | |
439869bf |
490 | @item |
e07b6b46 |
491 | @vindex hooks/nickname |
439869bf |
492 | @code{hooks/nickname} |
493 | @itemize @minus |
494 | @item |
495 | Description of the hook |
496 | @item |
497 | # of args |
498 | @itemize @minus |
499 | @item |
500 | @code{arg1}: desc |
501 | @end itemize |
502 | @end itemize |
503 | |
439869bf |
504 | @item |
e07b6b46 |
505 | @vindex hooks/signoff |
439869bf |
506 | @code{hooks/signoff} |
507 | @itemize @minus |
508 | @item |
509 | Description of the hook |
510 | @item |
511 | # of args |
512 | @itemize @minus |
513 | @item |
514 | @code{arg1}: desc |
515 | @end itemize |
516 | @end itemize |
517 | |
439869bf |
518 | @item |
e07b6b46 |
519 | @vindex hooks/ctcp |
439869bf |
520 | @code{hooks/ctcp} |
521 | @itemize @minus |
522 | @item |
523 | Description of the hook |
524 | @item |
525 | # of args |
526 | @itemize @minus |
527 | @item |
528 | @code{arg1}: desc |
529 | @end itemize |
530 | @end itemize |
531 | |
439869bf |
532 | @item |
e07b6b46 |
533 | @vindex hooks/ctcp-reply |
439869bf |
534 | @code{hooks/ctcp-reply} |
535 | @itemize @minus |
536 | @item |
537 | Description of the hook |
538 | @item |
539 | # of args |
540 | @itemize @minus |
541 | @item |
542 | @code{arg1}: desc |
543 | @end itemize |
544 | @end itemize |
545 | |
439869bf |
546 | @item |
e07b6b46 |
547 | @vindex hooks/disconnect |
439869bf |
548 | @code{hooks/disconnect} |
549 | @itemize @minus |
550 | @item |
551 | Description of the hook |
552 | @item |
553 | # of args |
554 | @itemize @minus |
555 | @item |
556 | @code{arg1}: desc |
557 | @end itemize |
558 | @end itemize |
559 | |
439869bf |
560 | @item |
e07b6b46 |
561 | @vindex hooks/flood |
439869bf |
562 | @code{hooks/flood} |
563 | @itemize @minus |
564 | @item |
565 | Description of the hook |
566 | @item |
567 | # of args |
568 | @itemize @minus |
569 | @item |
570 | @code{arg1}: desc |
571 | @end itemize |
572 | @end itemize |
573 | |
439869bf |
574 | @item |
e07b6b46 |
575 | @vindex hooks/invite |
439869bf |
576 | @code{hooks/invite} |
577 | @itemize @minus |
578 | @item |
579 | Description of the hook |
580 | @item |
581 | # of args |
582 | @itemize @minus |
583 | @item |
584 | @code{arg1}: desc |
585 | @end itemize |
586 | @end itemize |
587 | |
439869bf |
588 | @item |
e07b6b46 |
589 | @vindex hooks/join |
439869bf |
590 | @code{hooks/join} |
591 | @itemize @minus |
592 | @item |
593 | Description of the hook |
594 | @item |
595 | # of args |
596 | @itemize @minus |
597 | @item |
598 | @code{arg1}: desc |
599 | @end itemize |
600 | @end itemize |
601 | |
439869bf |
602 | @item |
e07b6b46 |
603 | @vindex hooks/kick |
439869bf |
604 | @code{hooks/kick} |
605 | @itemize @minus |
606 | @item |
607 | Description of the hook |
608 | @item |
609 | # of args |
610 | @itemize @minus |
611 | @item |
612 | @code{arg1}: desc |
613 | @end itemize |
614 | @end itemize |
615 | |
439869bf |
616 | @item |
e07b6b46 |
617 | @vindex hooks/part |
439869bf |
618 | @code{hooks/part} |
619 | @itemize @minus |
620 | @item |
621 | Description of the hook |
622 | @item |
623 | # of args |
624 | @itemize @minus |
625 | @item |
626 | @code{arg1}: desc |
627 | @end itemize |
628 | @end itemize |
629 | |
439869bf |
630 | @item |
e07b6b46 |
631 | @vindex hooks/mode |
439869bf |
632 | @code{hooks/mode} |
633 | @itemize @minus |
634 | @item |
635 | Description of the hook |
636 | @item |
637 | # of args |
638 | @itemize @minus |
639 | @item |
640 | @code{arg1}: desc |
641 | @end itemize |
642 | @end itemize |
643 | |
439869bf |
644 | @item |
e07b6b46 |
645 | @vindex hooks/message |
439869bf |
646 | @code{hooks/message} |
647 | @itemize @minus |
648 | @item |
649 | Description of the hook |
650 | @item |
651 | # of args |
652 | @itemize @minus |
653 | @item |
654 | @code{arg1}: desc |
655 | @end itemize |
656 | @end itemize |
657 | |
439869bf |
658 | @item |
e07b6b46 |
659 | @vindex hooks/notice |
439869bf |
660 | @code{hooks/notice} |
661 | @itemize @minus |
662 | @item |
663 | Description of the hook |
664 | @item |
665 | # of args |
666 | @itemize @minus |
667 | @item |
668 | @code{arg1}: desc |
669 | @end itemize |
670 | @end itemize |
671 | |
439869bf |
672 | @item |
e07b6b46 |
673 | @vindex hooks/public |
439869bf |
674 | @code{hooks/public} |
675 | @itemize @minus |
676 | @item |
677 | Description of the hook |
678 | @item |
679 | # of args |
680 | @itemize @minus |
681 | @item |
682 | @code{arg1}: desc |
683 | @end itemize |
684 | @end itemize |
685 | |
439869bf |
686 | @item |
e07b6b46 |
687 | @vindex hooks/public-notice |
439869bf |
688 | @code{hooks/public-notice} |
689 | @itemize @minus |
690 | @item |
691 | Description of the hook |
692 | @item |
693 | # of args |
694 | @itemize @minus |
695 | @item |
696 | @code{arg1}: desc |
697 | @end itemize |
698 | @end itemize |
699 | |
439869bf |
700 | @item |
e07b6b46 |
701 | @vindex hooks/raw |
439869bf |
702 | @code{hooks/raw} |
703 | @itemize @minus |
704 | @item |
705 | Description of the hook |
706 | @item |
707 | # of args |
708 | @itemize @minus |
709 | @item |
710 | @code{arg1}: desc |
711 | @end itemize |
712 | @end itemize |
713 | |
439869bf |
714 | @item |
e07b6b46 |
715 | @vindex hooks/timer |
439869bf |
716 | @code{hooks/timer} |
717 | @itemize @minus |
718 | @item |
719 | Description of the hook |
720 | @item |
721 | # of args |
722 | @itemize @minus |
723 | @item |
724 | @code{arg1}: desc |
725 | @end itemize |
726 | @end itemize |
727 | |
439869bf |
728 | @item |
e07b6b46 |
729 | @vindex hooks/topic |
439869bf |
730 | @code{hooks/topic} |
731 | @itemize @minus |
732 | @item |
733 | Description of the hook |
734 | @item |
735 | # of args |
736 | @itemize @minus |
737 | @item |
738 | @code{arg1}: desc |
739 | @end itemize |
740 | @end itemize |
741 | |
0b7a49e2 |
742 | @item |
743 | @vindex hooks/dcc/begin |
744 | @code{hooks/dcc/begin} |
745 | @itemize @minus |
746 | @item |
747 | This hook is triggered when a user begins a DCC CHAT with the bot. |
748 | @item |
749 | @var{FROM} |
750 | @itemize @minus |
751 | @item |
752 | @var{FROM}: This is the user's address in the form |
753 | @samp{nick!user@@host}. |
754 | @end itemize |
755 | @end itemize |
756 | |
757 | @item |
758 | @vindex hooks/dcc/message |
759 | @code{hooks/dcc/message} |
760 | @itemize @minus |
761 | @item |
762 | This hook is triggered when a user sends a message to the bot through |
763 | a DCC CHAT |
764 | @item |
765 | @var{FROM} @var{MESSAGE} |
766 | @itemize @minus |
767 | @item |
768 | @var{FROM}: This is the user's address in the form |
769 | @samp{nick!user@@host}. |
770 | @item |
771 | @var{MESSAGE}: This is the message the user sent to the bot. |
772 | @end itemize |
773 | @end itemize |
439869bf |
774 | @end itemize |
775 | |
776 | |
e07b6b46 |
777 | @node Scheme User Levels, Sending Messages, Hooks, Scripting |
778 | @section Scheme User Levels |
779 | |
780 | @vindex user-none |
781 | @vindex user-user |
782 | @vindex user-trusted |
783 | @vindex user-friend |
784 | @vindex user-master |
785 | There are five levels that a user may be when interfacing with a bot: |
786 | @var{none}, @var{user}, @var{trusted_user}, @var{friend}, |
787 | @var{master}. The Scheme variables for the user levels are |
788 | @code{bot:user-none}, @code{bot:user-user}, @code{bot:user-trusted}, |
789 | @code{bot:user-friend}, and @code{bot:user-master}. See @ref{User |
790 | Levels} for more information on User Levels. |
791 | |
792 | When adding a new command, think about who should be able to use |
793 | it. Is your command a general purpose command that helps the channel |
794 | (e.g. @code{!seen}) that everyone should be able to use? Or is it |
795 | something that should be restricted? See @ref{User Levels} for |
796 | information on what level users can do what with the built in bot |
797 | commands and think about what level a user your command is targetted |
798 | towards. You must be @emph{very} careful when giving new commands to |
799 | lower level users because you can do basically everything the bot can |
800 | do with a script. As the scripting interface becomes more powerful, |
801 | you must think more about what users can use new commands you add. |
802 | |
91dddabd |
803 | @node Sending Messages, Misc Scripting Stuff, Scheme User Levels, Scripting |
e07b6b46 |
804 | @section Sending Messages |
805 | |
806 | There are several types of messages you can send with Bobot++ from |
807 | scripts. There is the simple, but rather limited, @code{bot:say}, |
808 | @code{bot:action} and @code{bot:msg}, and |
809 | the more powerful, but lower level, @code{bot:send-MESSAGE} |
810 | functions. Most bots will probably only need the higher level |
811 | functions, but for the sake of why-not Bobot++ lets you use the lower |
ce02032f |
812 | level functions (in progress). |
e07b6b46 |
813 | |
814 | @menu |
815 | * High Level Message Functions:: |
816 | * Low Level Message Functions:: |
817 | @end menu |
818 | |
819 | @node High Level Message Functions, Low Level Message Functions, Sending Messages, Sending Messages |
820 | @subsection ``High Level'' Message Functions |
821 | |
822 | ... |
823 | |
824 | @node Low Level Message Functions, , High Level Message Functions, Sending Messages |
825 | @subsection ``Low Level'' Message Functions |
826 | |
827 | The ``Low Level'' messaging functions allow you to do things like send |
828 | CTCP messages. You probably want to read rfc 2812 and the CTCP spec |
829 | before using these. If you have no idea what these do, read rfc 2812 |
830 | (IRC Client Protocol) and CTCP spec. These functions all return |
831 | @code{*unspecified*} always, so don't use the return value for anything. |
832 | |
833 | @itemize @bullet |
834 | |
835 | @item @code{bot:send-CTCP to command message} |
836 | @code{to} is the target of your CTCP message, @code{command} is the |
837 | CTCP command, and @code{message} is the message (or arguments) of the |
838 | command. Make sure to @code{bot:ctcp-quote} the message! |
839 | |
840 | @end itemize |
841 | |
91dddabd |
842 | @node Misc Scripting Stuff, , Sending Messages, Scripting |
843 | @section Misc. Scripting Stuff |
844 | |
845 | These are a few useful things that I thought people writing scripts |
846 | might want to know. |
847 | |
fed59248 |
848 | @vindex exit-hook |
91dddabd |
849 | If you want to execute code when the bot exits, just do |
850 | @code{add-hook! bot:exit-hook @var{thunk}} where @var{thunk} is an |
851 | argumentless procedure (a thunk). When the bot exits your thunk will |
852 | be called. |
853 | |
31433d27 |
854 | @node Concept Index, Function Index, Scripting, Top |
855 | @unnumbered Concept Index |
856 | @printindex cp |
857 | |
858 | @node Function Index, Variable Index, Concept Index, Top |
859 | @unnumbered Function Index |
860 | @printindex fn |
861 | |
862 | @node Variable Index, , Function Index, Top |
863 | @unnumbered Variable Index |
864 | @printindex vr |
91dddabd |
865 | |
866 | @bye |