e171dcce |
1 | This is bobot++.info, produced by makeinfo version 4.3 from |
2e20c3e1 |
2 | bobot++.texinfo. |
3 | |
4 | This file documents Bobot++ by Clinton Ebadi and Etienne Bernard |
5 | (original author, no longer works on program). |
6 | |
7 | Copyright 2002 Clinton Ebadi |
8 | |
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 |
13 | Texts. |
14 | |
15 | \1f |
16 | File: bobot++.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir) |
17 | |
18 | This document describes Bobot++ by Clinton Ebadi and Etienne Bernard |
19 | (original author, no longer works on program). |
20 | |
21 | This document applies to version 2.1.0 of the program named Bobot++ |
22 | |
439869bf |
23 | Copyright 2002 Clinton Ebadi |
24 | |
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 |
29 | Texts. |
30 | |
2e20c3e1 |
31 | * Menu: |
32 | |
33 | * Introduction:: |
ad529fde |
34 | * Configuration:: |
e07b6b46 |
35 | * Using the Bot:: |
ad529fde |
36 | * Scripting:: |
37 | * Concept Index:: |
38 | * Function Index:: |
39 | * Variable Index:: |
2e20c3e1 |
40 | |
41 | \1f |
ad529fde |
42 | File: bobot++.info, Node: Introduction, Next: Configuration, Prev: Top, Up: Top |
2e20c3e1 |
43 | |
44 | Introduction |
45 | ************ |
46 | |
ad529fde |
47 | This manual feels abused and neglected because it has almost no |
48 | content. |
2e20c3e1 |
49 | |
ad529fde |
50 | \1f |
e07b6b46 |
51 | File: bobot++.info, Node: Configuration, Next: Using the Bot, Prev: Introduction, Up: Top |
ad529fde |
52 | |
53 | Configuration |
54 | ************* |
55 | |
56 | Bobot++ is easy to configure. The configuration file format may be |
57 | changing in the 2.1 series, so it is not documented for now. See the |
58 | `examples' directory for an example configuration. |
59 | |
60 | * Menu: |
61 | |
62 | * Configuration File Syntax:: |
63 | * Configure File Placement:: |
64 | |
65 | \1f |
66 | File: bobot++.info, Node: Configuration File Syntax, Next: Configure File Placement, Prev: Configuration, Up: Configuration |
67 | |
68 | Configuration File Syntax |
69 | ========================= |
70 | |
e171dcce |
71 | * Menu: |
72 | |
73 | * bot.conf:: |
74 | |
75 | \1f |
76 | File: bobot++.info, Node: bot.conf, Prev: Configuration File Syntax, Up: Configuration File Syntax |
77 | |
78 | bot.conf |
79 | -------- |
80 | |
81 | bot.conf is the main configuration file for a Bobot++. The available |
82 | configuration variables are listed below in the format "VARIABLE |
83 | <default-value>: description" |
84 | |
85 | * NICKNAME <Bobot>: The nickname of the bot (NICK is an alias for |
86 | NICKNAME) |
87 | |
88 | * USERNAME <bobot>: The IRC username of the bot |
89 | |
90 | * CMDCHAR <!>: The character that prefixes commands given to the bot |
91 | (COMMAND is an alias for CMDCHAR) |
92 | |
93 | * IRCNAME <I'm a bobot++!>: The IRC name (or 'real name') of the bot |
94 | (REALNAME is an alias for IRCNAME) |
95 | |
96 | * USERLIST <bot.users>: Name of the file where the userlist is stored |
97 | |
98 | * SHITLIST <bot.shit>: Name of the file where the shitlist is stored |
99 | |
100 | * LOGFILE <$LOGDIR/bot.log>: |
101 | |
ad529fde |
102 | |
103 | \1f |
104 | File: bobot++.info, Node: Configure File Placement, Prev: Configuration File Syntax, Up: Configuration |
105 | |
106 | Configuration File Placement |
107 | ============================ |
108 | |
109 | Bobot++ will look in `/etc/bobotpp/default/' for its default config |
110 | if none is specified on the command line. Put the configuration files |
111 | you want to be loaded by default in this directory. If you are not root |
112 | or you want to have your own personal configration, put it in |
113 | `~/.bobotpp/config/default/'. |
114 | |
115 | \1f |
e07b6b46 |
116 | File: bobot++.info, Node: Using the Bot, Next: Scripting, Prev: Configuration, Up: Top |
117 | |
118 | Using Bobot++ |
119 | ************* |
120 | |
121 | FIXME: stuff here... |
122 | |
123 | * Menu: |
124 | |
125 | * User Levels:: |
126 | |
127 | \1f |
128 | File: bobot++.info, Node: User Levels, Prev: Using the Bot, Up: Using the Bot |
129 | |
130 | User Levels |
131 | =========== |
132 | |
133 | There are five levels that a user may be when interfacing with a bot: |
134 | NONE, USER, TRUSTED_USER, FRIEND, MASTER. All users default to NONE |
135 | unless they are changed by a script, the `!adduser' command or the |
136 | `bot.users' file. NONE is for everyone--very few commands (e.g. help) |
137 | are available to the users and almost everyone should be this level. A |
138 | USER can execute many of the bot commands, but can't use masks on kicks |
139 | and bans. A TRUSTED user can everything a USER can do, but can also use |
140 | masks on kicks and bans. A FRIEND can do everything except for stopping |
141 | the bot (be careful who you give this to!). The MASTER level is for the |
142 | bot's owner (probably you) and can do _everything_ to the bot. Be |
143 | _very_ careful if you give MASTER level access to anyone else. You |
144 | cannot use this symbolic levels with the `!adduser' command. See |
145 | (FIXME: ref) for the numbers you must use with `!adduser'. |
146 | |
147 | \1f |
148 | File: bobot++.info, Node: Scripting, Next: Concept Index, Prev: Using the Bot, Up: Top |
ad529fde |
149 | |
150 | Scripting |
151 | ********* |
152 | |
153 | Bobot++'s most powerful feature is its scripting system. You write |
154 | scripts using Guile Scheme. This manual does not cover how to use Guile |
155 | or how to learn Scheme. *Note Guile Reference Manual: (guile)Top, for |
156 | the Guile reference manual and |
157 | <http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme.html> for a |
158 | good tutorial on Scheme. |
159 | |
439869bf |
160 | Note that in previous versions the scripting commands where in the |
161 | form `bot-FUNCTION'. They are now in the form `bot:FUNCTION'. The old |
162 | names are still available, but are deprecated and will be removed in |
163 | Bobot++ 2.4. The command `perl -pi -e ``s/bot-/bot:/g'' YOUR-FILES' |
164 | should be enough to convert your code to use the new functions. |
165 | |
166 | * Menu: |
167 | |
168 | * Adding New Commands:: |
169 | * Hooks:: |
e07b6b46 |
170 | * Scheme User Levels:: |
171 | * Sending Messages:: |
91dddabd |
172 | * Misc Scripting Stuff:: |
439869bf |
173 | |
174 | \1f |
175 | File: bobot++.info, Node: Adding New Commands, Next: Hooks, Prev: Scripting, Up: Scripting |
176 | |
177 | Adding New Commands |
178 | =================== |
179 | |
e07b6b46 |
180 | Adding a new command is simple. To register a new command use |
181 | `bot:addcommand'. The prototype for `bot:addcommand' is |
182 | `(bot:addcommand name func needs-channel? num-of-args min-level)'. The |
183 | `name' is a string representing the name of the command being added. |
184 | `func' is a function accepting `num-of-args' arguments. |
185 | `needs-channel?' is a bool that is true if the function needs the |
186 | channel name as its first arg, and false otherwise. `num-of-args' is |
187 | the number of args `func' will take and must be within zero (0) and |
188 | twenty (20). `min-level' is one of the *Note Scheme User Levels::. A |
189 | user must be at least a `min-level' user to use the new command. None |
190 | of the arguments are guaranteed to be passed; if they aren't they are |
191 | set to the empty string `""'. An example of a new command would be: |
e07b6b46 |
192 | |
fed59248 |
193 | (define (hello channel name) |
194 | (if (string=? name "") |
195 | (bot:say channel "Hello world!") |
196 | (bot:say channel (string-append "Hello " name "!"))) |
197 | |
198 | (bot:addcommand "hello" hello #t 2 0) |
e07b6b46 |
199 | |
fed59248 |
200 | This will display "Hello World!" if called as `!hello' and "Hello |
201 | World `USER'" if called as `!hello USER'. |
439869bf |
202 | |
203 | \1f |
e07b6b46 |
204 | File: bobot++.info, Node: Hooks, Next: Scheme User Levels, Prev: Adding New Commands, Up: Scripting |
439869bf |
205 | |
206 | Hooks |
207 | ===== |
208 | |
209 | Hooks are a powerful feature of Bobot++. Hooks are a hybrid of ircII |
6530edbf |
210 | and tiny fugue (a MUD bot) hooks with a little bit of extra stuff added |
211 | in. The basic idea of a hook if that you match a text against regular |
212 | expression and call a function if text in a message matches that regex. |
213 | The different types of hooks provided by Bobot++ correspond to the |
214 | different classes of messages that Bobot++ can recieve. A Hook also has |
215 | several properties, including its priority and whether or not it is a |
216 | fallthrough hook. Higher priority hooks are executed before lower |
217 | priority hooks and fallthrough hooks are executed before |
218 | non-fallthrough hooks of the same priority. A fallthrough hook can |
219 | match and processing of hooks will continue; as soon as the first |
220 | non-fallthrough hooks matches processing of hooks stops. |
439869bf |
221 | |
222 | * Menu: |
223 | |
224 | * Creating a Hook:: |
225 | * Hook Types:: |
226 | |
227 | \1f |
228 | File: bobot++.info, Node: Creating a Hook, Next: Hook Types, Prev: Hooks, Up: Hooks |
229 | |
230 | Creating a Hook |
231 | --------------- |
232 | |
233 | To add a new hook you use the function `bot:addhook'. `bot:addhook' |
fd7440f1 |
234 | is prototyped as `(bot:addhook type regex function pri fall name)'. |
235 | `type' specifies the type of hook (the types of hooks are listed in |
236 | *Note Hook Types::). `regex' is a standard regular expression. If |
237 | `regex' is matched, `function' will be called. `function' will take a |
238 | different number of args depending on the hook type. `pri' specifies |
fed59248 |
239 | the priority of the hook--higher priority hooks are executed first. |
fd7440f1 |
240 | This argument is optional and defaults to `0'. `fall' is `#t' if the |
241 | hook is a fallthrough hook and `#f' is the hook is not a fallthrough |
242 | hook. This arg is also optional and default to `#t'. `name' is the |
fed59248 |
243 | optional name of the hook that defaults to "DEFAULT". If you set the |
fd7440f1 |
244 | name then you can have more than one hook that matches the same regexp, |
245 | as long as they have the same name. E.g. in a log script you could have |
246 | the regexps for the log function all be `".*"' and set their names to |
247 | `"log"' to avoid a conflict with other hooks. |
439869bf |
248 | |
249 | \1f |
250 | File: bobot++.info, Node: Hook Types, Prev: Creating a Hook, Up: Hooks |
251 | |
252 | Hook Types |
253 | ---------- |
254 | |
255 | Here is a list of the various hooks are notes on each one. The |
256 | general format of a hook is: |
257 | |
258 | * `hooks/name' (this is the Scheme variable name of the hook) |
259 | - Description of the hook |
260 | |
fed59248 |
261 | - ARG1 ARG2 ... ARGN |
262 | - ARG1: desc |
439869bf |
263 | |
fed59248 |
264 | - ARG2: desc |
439869bf |
265 | |
266 | - ... |
267 | |
fed59248 |
268 | - ARGN: desc |
439869bf |
269 | |
e07b6b46 |
270 | That said, here is the list of available hooks: FIXME: write docs |
439869bf |
271 | |
272 | * `hooks/action' |
fed59248 |
273 | - This hook is triggered when someone performs an action. |
439869bf |
274 | |
fed59248 |
275 | - FROM, TO, ACTION |
276 | - FROM: this is the address of the person that performed |
0b7a49e2 |
277 | the action in the form `NICK ! USER @ HOST' (without the |
fed59248 |
278 | spaces). |
279 | |
280 | - TO: This is the target of the action, which is either a |
281 | channel or the Bot's nick. |
282 | |
283 | - ACTION: This is the text of the action. E.g. if someone |
284 | did `* foobar does baz', then ACTION would be the string |
285 | `"does baz"'. |
439869bf |
286 | |
439869bf |
287 | * `hooks/nickname' |
288 | - Description of the hook |
289 | |
290 | - # of args |
291 | - `arg1': desc |
292 | |
439869bf |
293 | * `hooks/signoff' |
294 | - Description of the hook |
295 | |
296 | - # of args |
297 | - `arg1': desc |
298 | |
439869bf |
299 | * `hooks/ctcp' |
300 | - Description of the hook |
301 | |
302 | - # of args |
303 | - `arg1': desc |
304 | |
439869bf |
305 | * `hooks/ctcp-reply' |
306 | - Description of the hook |
307 | |
308 | - # of args |
309 | - `arg1': desc |
310 | |
439869bf |
311 | * `hooks/disconnect' |
312 | - Description of the hook |
313 | |
314 | - # of args |
315 | - `arg1': desc |
316 | |
439869bf |
317 | * `hooks/flood' |
318 | - Description of the hook |
319 | |
320 | - # of args |
321 | - `arg1': desc |
322 | |
439869bf |
323 | * `hooks/invite' |
324 | - Description of the hook |
325 | |
326 | - # of args |
327 | - `arg1': desc |
328 | |
439869bf |
329 | * `hooks/join' |
330 | - Description of the hook |
331 | |
332 | - # of args |
333 | - `arg1': desc |
334 | |
439869bf |
335 | * `hooks/kick' |
336 | - Description of the hook |
337 | |
338 | - # of args |
339 | - `arg1': desc |
340 | |
439869bf |
341 | * `hooks/part' |
342 | - Description of the hook |
343 | |
344 | - # of args |
345 | - `arg1': desc |
346 | |
439869bf |
347 | * `hooks/mode' |
348 | - Description of the hook |
349 | |
350 | - # of args |
351 | - `arg1': desc |
352 | |
439869bf |
353 | * `hooks/message' |
354 | - Description of the hook |
355 | |
356 | - # of args |
357 | - `arg1': desc |
358 | |
439869bf |
359 | * `hooks/notice' |
360 | - Description of the hook |
361 | |
362 | - # of args |
363 | - `arg1': desc |
364 | |
439869bf |
365 | * `hooks/public' |
366 | - Description of the hook |
367 | |
368 | - # of args |
369 | - `arg1': desc |
370 | |
439869bf |
371 | * `hooks/public-notice' |
372 | - Description of the hook |
373 | |
374 | - # of args |
375 | - `arg1': desc |
376 | |
439869bf |
377 | * `hooks/raw' |
378 | - Description of the hook |
379 | |
380 | - # of args |
381 | - `arg1': desc |
382 | |
439869bf |
383 | * `hooks/timer' |
384 | - Description of the hook |
385 | |
386 | - # of args |
387 | - `arg1': desc |
388 | |
439869bf |
389 | * `hooks/topic' |
390 | - Description of the hook |
391 | |
392 | - # of args |
393 | - `arg1': desc |
394 | |
0b7a49e2 |
395 | * `hooks/dcc/begin' |
396 | - This hook is triggered when a user begins a DCC CHAT with the |
397 | bot. |
398 | |
399 | - FROM |
400 | - FROM: This is the user's address in the form |
401 | `nick!user@host'. |
402 | |
403 | * `hooks/dcc/message' |
404 | - This hook is triggered when a user sends a message to the bot |
405 | through a DCC CHAT |
406 | |
407 | - FROM MESSAGE |
408 | - FROM: This is the user's address in the form |
409 | `nick!user@host'. |
410 | |
411 | - MESSAGE: This is the message the user sent to the bot. |
439869bf |
412 | |
e07b6b46 |
413 | \1f |
414 | File: bobot++.info, Node: Scheme User Levels, Next: Sending Messages, Prev: Hooks, Up: Scripting |
415 | |
416 | Scheme User Levels |
417 | ================== |
418 | |
419 | There are five levels that a user may be when interfacing with a bot: |
420 | NONE, USER, TRUSTED_USER, FRIEND, MASTER. The Scheme variables for the |
421 | user levels are `bot:user-none', `bot:user-user', `bot:user-trusted', |
422 | `bot:user-friend', and `bot:user-master'. See *Note User Levels:: for |
423 | more information on User Levels. |
424 | |
425 | When adding a new command, think about who should be able to use it. |
426 | Is your command a general purpose command that helps the channel (e.g. |
427 | `!seen') that everyone should be able to use? Or is it something that |
428 | should be restricted? See *Note User Levels:: for information on what |
429 | level users can do what with the built in bot commands and think about |
430 | what level a user your command is targetted towards. You must be _very_ |
431 | careful when giving new commands to lower level users because you can |
432 | do basically everything the bot can do with a script. As the scripting |
433 | interface becomes more powerful, you must think more about what users |
434 | can use new commands you add. |
435 | |
436 | \1f |
91dddabd |
437 | File: bobot++.info, Node: Sending Messages, Next: Misc Scripting Stuff, Prev: Scheme User Levels, Up: Scripting |
e07b6b46 |
438 | |
439 | Sending Messages |
440 | ================ |
441 | |
442 | There are several types of messages you can send with Bobot++ from |
443 | scripts. There is the simple, but rather limited, `bot:say', |
444 | `bot:action' and `bot:msg', and the more powerful, but lower level, |
445 | `bot:send-MESSAGE' functions. Most bots will probably only need the |
446 | higher level functions, but for the sake of why-not Bobot++ lets you |
ce02032f |
447 | use the lower level functions (in progress). |
e07b6b46 |
448 | |
449 | * Menu: |
450 | |
451 | * High Level Message Functions:: |
452 | * Low Level Message Functions:: |
453 | |
454 | \1f |
455 | File: bobot++.info, Node: High Level Message Functions, Next: Low Level Message Functions, Prev: Sending Messages, Up: Sending Messages |
456 | |
fed59248 |
457 | "High Level" Message Functions |
458 | ------------------------------ |
e07b6b46 |
459 | |
460 | ... |
461 | |
462 | \1f |
463 | File: bobot++.info, Node: Low Level Message Functions, Prev: High Level Message Functions, Up: Sending Messages |
464 | |
fed59248 |
465 | "Low Level" Message Functions |
466 | ----------------------------- |
e07b6b46 |
467 | |
fed59248 |
468 | The "Low Level" messaging functions allow you to do things like send |
469 | CTCP messages. You probably want to read rfc 2812 and the CTCP spec |
e07b6b46 |
470 | before using these. If you have no idea what these do, read rfc 2812 |
471 | (IRC Client Protocol) and CTCP spec. These functions all return |
472 | `*unspecified*' always, so don't use the return value for anything. |
473 | |
474 | * `bot:send-CTCP to command message' `to' is the target of your CTCP |
475 | message, `command' is the CTCP command, and `message' is the |
476 | message (or arguments) of the command. Make sure to |
477 | `bot:ctcp-quote' the message! |
478 | |
479 | |
91dddabd |
480 | \1f |
481 | File: bobot++.info, Node: Misc Scripting Stuff, Prev: Sending Messages, Up: Scripting |
482 | |
483 | Misc. Scripting Stuff |
484 | ===================== |
485 | |
486 | These are a few useful things that I thought people writing scripts |
487 | might want to know. |
488 | |
489 | If you want to execute code when the bot exits, just do `add-hook! |
490 | bot:exit-hook THUNK' where THUNK is an argumentless procedure (a |
491 | thunk). When the bot exits your thunk will be called. |
492 | |
ad529fde |
493 | \1f |
494 | File: bobot++.info, Node: Concept Index, Next: Function Index, Prev: Scripting, Up: Top |
495 | |
496 | Concept Index |
497 | ************* |
498 | |
499 | * Menu: |
e07b6b46 |
500 | |
501 | * Background on Hooks: Hooks. |
502 | |
ad529fde |
503 | \1f |
504 | File: bobot++.info, Node: Function Index, Next: Variable Index, Prev: Concept Index, Up: Top |
505 | |
506 | Function Index |
507 | ************** |
508 | |
509 | * Menu: |
e07b6b46 |
510 | |
511 | * addcommand: Adding New Commands. |
512 | * addhook: Creating a Hook. |
513 | |
ad529fde |
514 | \1f |
515 | File: bobot++.info, Node: Variable Index, Prev: Function Index, Up: Top |
516 | |
517 | Variable Index |
518 | ************** |
519 | |
520 | * Menu: |
2e20c3e1 |
521 | |
fed59248 |
522 | * exit-hook: Misc Scripting Stuff. |
e07b6b46 |
523 | * hooks/action: Hook Types. |
524 | * hooks/ctcp: Hook Types. |
525 | * hooks/ctcp-reply: Hook Types. |
0b7a49e2 |
526 | * hooks/dcc/begin: Hook Types. |
527 | * hooks/dcc/message: Hook Types. |
e07b6b46 |
528 | * hooks/disconnect: Hook Types. |
529 | * hooks/flood: Hook Types. |
530 | * hooks/invite: Hook Types. |
531 | * hooks/join: Hook Types. |
532 | * hooks/kick: Hook Types. |
533 | * hooks/message: Hook Types. |
534 | * hooks/mode: Hook Types. |
535 | * hooks/nickname: Hook Types. |
536 | * hooks/notice: Hook Types. |
537 | * hooks/part: Hook Types. |
538 | * hooks/public: Hook Types. |
539 | * hooks/public-notice: Hook Types. |
540 | * hooks/raw: Hook Types. |
541 | * hooks/signoff: Hook Types. |
542 | * hooks/timer: Hook Types. |
543 | * hooks/topic: Hook Types. |
544 | * user-friend: Scheme User Levels. |
545 | * user-master: Scheme User Levels. |
546 | * user-none: Scheme User Levels. |
547 | * user-trusted: Scheme User Levels. |
548 | * user-user: Scheme User Levels. |
549 | |
550 | |
2e20c3e1 |
551 | \1f |
552 | Tag Table: |
553 | Node: Top\7f517 |
e07b6b46 |
554 | Node: Introduction\7f1246 |
555 | Node: Configuration\7f1437 |
556 | Node: Configuration File Syntax\7f1823 |
e171dcce |
557 | Node: bot.conf\7f2030 |
558 | Node: Configure File Placement\7f2865 |
559 | Node: Using the Bot\7f3339 |
560 | Node: User Levels\7f3513 |
561 | Node: Scripting\7f4517 |
562 | Node: Adding New Commands\7f5425 |
563 | Node: Hooks\7f6692 |
564 | Node: Creating a Hook\7f7666 |
565 | Node: Hook Types\7f8805 |
566 | Node: Scheme User Levels\7f12279 |
567 | Node: Sending Messages\7f13408 |
568 | Node: High Level Message Functions\7f14019 |
569 | Node: Low Level Message Functions\7f14233 |
570 | Node: Misc Scripting Stuff\7f14986 |
571 | Node: Concept Index\7f15405 |
572 | Node: Function Index\7f15587 |
573 | Node: Variable Index\7f15848 |
2e20c3e1 |
574 | \1f |
575 | End Tag Table |